[Javascript]Knowing the height of an HTML element
To determine the height of a HTML block using JavaScript, independently from the type browsers used, there are two methods:
- element.offsetHeight
- element.style.pixelHeight
The following code implement these above methods, allowing you to determine the height of a block HTML regardless of the browser used:
<script type="text/javascript">
<!--
var divHeight;
var obj = document.getElementById('id_element');
if(obj.offsetHeight) {divHeight=obj.offsetHeight;}
else if(obj.style.pixelHeight){divHeight=obj.style.pixelHeight;}
//-->
</script>