Get the tag offset : offsetHeight « Javascript Properties « JavaScript DHTML






Get the tag offset

 


<html>
<head>
<title>Overflow</title>
<style type="text/css">
#div1 { width: 700px; height: 150px }
#div2 { width: 600px; height: 100px; overflow: auto }
</style>

<script type="text/javascript">
function switchContent() {
    document.write(document.getElementById("div2").offsetHeight);
}
</script>
</head>
<body>
<p>
<a href="javascript:switchContent();">Switch</a> 
</p>
<div id="div1">
    <p>p1</p>
</div>
<div id="div2">
    <p>Smaller item.</p>
</div>
</body>
</html>

   
  








Related examples in the same category