Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1400 How do I measure the height of my document?

irt.org | Knowledge Base | DHTML | Q1400 [ previous next ]

Q1400 How do I measure the height of my document?

In Internet Explorer 4+:

<script language="JavaScript"><!--
function height() {
    if (document.all) 
        alert('Document height = ' + document.body.offsetHeight);
}
//--></script>

If you must have the height in Netscape Navigator then include the complete page contents in a layer:

<html>
<head>
<script language="JavaScript"><!--
function height() {
    if (document.all) 
        alert('Document height = ' + document.body.offsetHeight);
    else if (document.layers)
        alert('Document height = ' + document.body.document.height);
}
//--></script>
</head>

<body onLoad="height()">

<ilayer id="body">
*** Place your page contents in here ***
</ilayer>

</body>
</html>

Feedback on 'Q1400 How do I measure the height of my document?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.