Forum Moderators: open
Using Firefox:
I'm trying to get the height of my header, which looks something like this:
<div id="header">
<p>This is some text</p>
<div id="innerHeader">
blah, blah.
</div>
</div>
The problem is, when I do:
document.getElementById("header").offsetHeight;
It returns the height of the header paragraph, without the height of the nested "innerHeader".
Is there some general way to get the total height of the whole nested header div? I know I can work around it case by case, for example eliminating the inner div, or getting it's height and adding it to the outer div, but if there is a more elegant general approach, I'd like to find it.
Thanks for any insight,
Paul
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset:utf-8">
<title></title>
</head>
<body>
<div id="header">
<p>This is some text</p>
<div id="innerHeader">
blah, blah.
</div>
</div>
<script type="text/javascript">
var header = document.getElementById('header');
var h = header.offsetHeight;
alert( h );
</script>
</body>
</html>