Entry
Detecting height of dynamic elements in NN6
Jan 18th, 2001 15:39
Ian Grant, Jan Willem Boer,
When an elements style height property is read, this property returns
the height as it is described in the HTML page. To get the real height
of the element, IE uses element.offsetHeight.
In NN6 this property can also be used:
realheight = document.getElementsByTagName('div')[0].offsetHeight;
Another way of getting the real height is:
test = document.getElementsByTagName('div')[0];
realheight = document.defaultView.getComputedStyle
(test, "").getPropertyValue("height");
The function getComputedStyle() is documented in the W3C DOM
recommendation http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-
20001113/css.html#CSS-ViewCSS, so i think this is the official way to
do it. However, it is not supported in IE5.
It is also possible to use getElementById('myId') in place of
getElementsByTagName('div')[0].