View Full Version : using javascript to find the page height

02-16-2007, 10:22 PM

does anyone know any js code to find the whole height of a web page?

i am trying to make an image that moves from the top of the page to the bottom like a marqee. if i use document.body.offsetHeight to tell the image how far to move before returning to the top, the image only goes as far as the window height not the whole page so if you scroll down the image never reaches the bottom.

can anyone please tell me code to find the total page height or a good substitute for the marquee tag?

thanx :)

P.S. this is the code i'm using to act on an image placed at the top of the page with the variable winH found using document.body.offsetHeight:

var Timer1;

function down()
document.getElementById("zip").style.pixelTop += 2;
if (document.getElementById("zip").style.pixelTop > winH)
document.getElementById("zip").style.pixelTop -= (winH);
Timer1 = setInterval("down()", 15);

02-16-2007, 10:30 PM
Here's something I use: xDocSize (http://cross-browser.com/x/lib/view.php?sym=xDocSize)

02-17-2007, 01:13 AM
thanx, that helps a lot :)