[Javascript] height problem, part deux

Chris Basken chriz at basken.com
Mon Apr 30 10:03:46 CDT 2001


hey all,

right now if i do something like:

	<img src="foo.gif" width=300 height=300 name="bar">

and using JS, i ask for:

	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).

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.

ready for the kicker?  works fine for width.  pixels, percentages, no
problem.  it's just height that's got an issue.

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?

didn't think so.  but thanks for the brain cells...





More information about the Javascript mailing list