Click to See Complete Forum and Search --> : get height
Ice3T
10-24-2003, 10:13 PM
I want to get the Height of a div tag how can I make this work
<body onLoad=window.status=document.getElementById('vid').height>
<div id=vid>blah blah blah<Br>blah blah...</div>
This gives me "undefined"
Khalid Ali
10-24-2003, 10:25 PM
you can try using
obj.offsetHeight,
however in NS6+ you can only get it if you set the height of the div,in IE you will get a number with reference to the main window
Give the element some position
<div id="vid" style="position:relative;">blah blah blah<br />blah blah...</div>
then call WinStatus
function WinStatus() {
Obj=document.getElementById('vid');
// ie & opera : mozilla & nn
window.status=(Obj.clientHeight)? Obj.clientHeight : Obj.offsetHeight;
}
Ice3T
10-26-2003, 11:41 AM
Super, thanks.