[thelist] clientHeight vs. offsetHeight

Tom Dell'Aringa pixelmech at yahoo.com
Tue Jul 30 10:27:01 CDT 2002


Thanks Duncan, I will try some of this out!
--- Duncan O'Neill <dbaxo at ihug.co.nz> wrote:
> Tom Dell'Aringa wrote:
> > Heyo,
> >
> > Fiddling with a CSS layout. I know that NN6/Mozilla do not
> support
> > clientHeight, they have offsetHeight. Problem is they are two
> > different things. offsetHeight gives you the amount of pixels
> offset
> > from the offsetParent (their words, not mine.)
> >
> > Anyway, what I want to do is to get the height in pixels of an
> > element in NN6 and Mozilla. Is there a way to do this? I am
> coming up
> > empty.
>
> Tom,
>
> these ideas may help - or not....
>
> if you know the ID of an element, you can get it's height
> like below. But from quick testing it only works if the
> height is explicit and inline;
>
> document.getElementById('IDname').getAttribute('height')
>
> You can also try this;
>
> document.getElementsByTagName('img').item(0).getAttribute('height')
>
> e.g. you could use this to get an array of image
> heights (not tested)
>
> imgHeights = new Array();
>
> for (var i=0;i<document.images.length;i++){
>
imgHeights[i]=document.getElementsByTagName('img').item(i).getAttribute('height');
> }
>
> getting properties out of stlyesheets becomes more involved.
> Steven Champeon has written a helpful article about methods
> of doing this here;
>
> http://developer.apple.com/internet/javascript/styles.html
>
> hth,
> --
> =====================================================
> Duncan O'Neill
> "Smith The Reporter"
> http://homepages.ihug.co.nz/~dbaxo/urban_legend.htm
> =====================================================
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !


=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



More information about the thelist mailing list