...

View Full Version : Finding Div Height when not explicitly set



rlemon
04-18-2005, 08:47 PM
i need to find a div tags height property, however it is not set in the source.

like
<div id="someDiv">some text</div>

document.getElementById('someDiv').style.height doens't work. :confused:

rlemon
04-18-2005, 11:23 PM
is there not like a pixelOffset?

Harry Armadillo
04-19-2005, 02:10 AM
offsetHeight

stymie
04-19-2005, 02:17 AM
function getStyle(el,styleProp)
{ var x = document.getElementById(el);
if (window.getComputedStyle)
{ var y = window.getComputedStyle(x,null).getPropertyValue(styleProp);
} //for FF
else
{ var y = x['currentStyle'][styleProp];
} //for IE
alert(y);
}


FireFox will return the height in pixels but
unless the property is assigned IE only returns auto...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum