Hi,
I've been trying for some time now to get the height (the 'scrollable'
height) of the current page (Thanks to Martin Honnen for help so far). I
feel as though I am almost there, but am having an unusual problem. (Please
see the code at the end of this page.)
The text "This text isn't being displayed" isn't, as you might have guessed,
being displayed.
I can't seem to display any 'normal' content unless I include it in the
<script>.
Why?
Why, why why?
Hope you can help,
Paul
----------
<html>
<head>
<title>Displa y Page Height</title>
<SCRIPT TYPE="text/javascript">
<!--
function pageHeight()
{
docHeight = 0;
if (typeof document.height != 'undefined')
{
docHeight = document.height ;
}
else if (document.compa tMode && document.compat Mode != 'BackCompat')
{
docHeight = document.docume ntElement.scrol lHeight;
}
else if (document.body && typeof document.body.s crollHeight != 'undefined')
{
docHeight = document.body.s crollHeight;
}
writeHeight(doc Height);
}
window.onload = pageHeight;
//-->
</SCRIPT>
</head>
<body>
<p>This text isn't being displayed!</p>
<SCRIPT TYPE="text/javascript">
<!--
function writeHeight(hei ght)
{
document.write( "Document has a height of " + height);
}
//-->
</SCRIPT>
</body>
</html>
I've been trying for some time now to get the height (the 'scrollable'
height) of the current page (Thanks to Martin Honnen for help so far). I
feel as though I am almost there, but am having an unusual problem. (Please
see the code at the end of this page.)
The text "This text isn't being displayed" isn't, as you might have guessed,
being displayed.
I can't seem to display any 'normal' content unless I include it in the
<script>.
Why?
Why, why why?
Hope you can help,
Paul
----------
<html>
<head>
<title>Displa y Page Height</title>
<SCRIPT TYPE="text/javascript">
<!--
function pageHeight()
{
docHeight = 0;
if (typeof document.height != 'undefined')
{
docHeight = document.height ;
}
else if (document.compa tMode && document.compat Mode != 'BackCompat')
{
docHeight = document.docume ntElement.scrol lHeight;
}
else if (document.body && typeof document.body.s crollHeight != 'undefined')
{
docHeight = document.body.s crollHeight;
}
writeHeight(doc Height);
}
window.onload = pageHeight;
//-->
</SCRIPT>
</head>
<body>
<p>This text isn't being displayed!</p>
<SCRIPT TYPE="text/javascript">
<!--
function writeHeight(hei ght)
{
document.write( "Document has a height of " + height);
}
//-->
</SCRIPT>
</body>
</html>
Comment