You can determine the true height of a DIV regardless of how much of it is actually exposed by first setting the DIV's CSS overflow to "scroll", then probing the property element.scrollHeight. For example:
Code:
<div id="test" style="background:red; height: 5px; overflow:scroll">
<p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
</div>
<script type="text/javascript">
var el=document.getElementById("test")
el.trueheight=el.scrollHeight
el.style.overflow="hidden"
alert(el.trueheight) //alerts 180 or so, true height of DIV
</script>
In the above, while the DIV's height has been explicitly set to 5px, you can still get its true height- content and all- but doing the above.
Bookmarks