[Javascript] height problem, part deux
Peter-Paul Koch
gassinaumasis at hotmail.com
Mon Apr 30 14:24:09 CDT 2001
> document.images['bar'].height
>
>i get '300' (as you would expect). but, if do:
>
> <img src="foo.gif" width=100% height=100% name="bar">
>
>and make the same JS reference, i get 2 different answers in NS4+ and IE5.
>in IE5, i get the number of pixels that '100%' resolves out to be, while in
>NS i get '0' (not 100%, which would make sense).
Interesting!
>interestingly, in IE6b, i also get '0', which mean either the beta has a
>bug (imagine that!) or they're depreciating the ability to resolve the
>number of pixels that percentages work out to be.
Try document.images['bar'].currentStyle.height, maybe it works.
>ready for the kicker? works fine for width. pixels, percentages, no
>problem. it's just height that's got an issue.
As far as I know NN4 has huge problems with images having a height of 100%
(I tried in tables and they were supposed to be as high as the TD).
>so, a question to masters: has anyone come up with a workaround to
>determine how many pixels an image "really" is when its height is dictated
>as a percentage, in NS?
Try document.images['bar'].offsetHeight in NN6 (maybe it also works in IE
5/6), for NN4 you have to place a DIV with position: relative around it and
ask for document.layers['divname'].clip.bottom, which gives the height of
the DIV (and thus the image).
ppk
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
More information about the Javascript
mailing list