bugman
02-24-2007, 11:46 AM
Hi. I've been running around the web, including a search here, but haven't hit upon a solution that works. I'm trying to determine the document height of a web page. The following code produces a 0 (zero) onload, and again when the button is pressed. Right now, I'm working with Firefox 2 on Ubuntu Edgy. I'll worry about IE compatability later. Thanks
<html>
<head>
<title>test</title>
<style type="text/css">
#container
{
position: absolute;
top: 0px;
left: 0px;
width: 500px;
height: 2000px;
border: 1px solid black;
}
</style>
<script type="text/javascript">
var _params=new Array();
function getParams()
{
var _docHeight = (typeof document.height != "undefined") ? document.height : document.body.scrollHeight;
var _docWidth = (document.width != "undefined") ? document.width : document.body.offsetWidth;
alert(_docHeight);
} // end function getParams()
</script>
</head>
<!-- onLoad="_params=getParams();" -->
<body onLoad="_params=getParams();">
<div id="container">
<form id="hi" action="#" method="post">
<input type="submit" onClick=('getParams();') value="click me" />
</form>
</div>
</body>
</html>
<html>
<head>
<title>test</title>
<style type="text/css">
#container
{
position: absolute;
top: 0px;
left: 0px;
width: 500px;
height: 2000px;
border: 1px solid black;
}
</style>
<script type="text/javascript">
var _params=new Array();
function getParams()
{
var _docHeight = (typeof document.height != "undefined") ? document.height : document.body.scrollHeight;
var _docWidth = (document.width != "undefined") ? document.width : document.body.offsetWidth;
alert(_docHeight);
} // end function getParams()
</script>
</head>
<!-- onLoad="_params=getParams();" -->
<body onLoad="_params=getParams();">
<div id="container">
<form id="hi" action="#" method="post">
<input type="submit" onClick=('getParams();') value="click me" />
</form>
</div>
</body>
</html>