...

View Full Version : Finding page height



calua
06-03-2004, 01:21 AM
Hello. I've been trying to do this but google isn't helping, although it did bring me here. Question: How do you find the height of a page? I don't want the "visible" part of it, that has to do with screen resolution and browser size, but the total pixels in it.
Anyone?

cheers
caluŃ

JAVAEOC
06-03-2004, 01:24 AM
did you try: document.height ????

calua
06-03-2004, 01:51 AM
Yes. if I put it in an alert, IE says 'undefined' and Moz says '0'.

nolachrymose
06-03-2004, 02:29 AM
document.body.clientHeight

Hope that helps!

Happy coding! :)

calua
06-03-2004, 09:19 PM
Still not working. This is the code:

alert(document.body.clientHeight);

and it returns a message box with the following:

0

what is wrong? Should something be set before using this? I put the code inside a <script language... after the body tag. Is that wrong?

nolachrymose
06-03-2004, 10:36 PM
Are you attempting to access the property before the page has loaded? I see no other reason for it to not work, besides an error somewhere else in the code.

Happy coding! :)

Unit
06-03-2004, 10:43 PM
I think clientHeight gives the height of the browser and scrollHeight gives the height of the document. scrollHeight is IE only as far as i know it

document.body.scrollHeight

You can use this to find the height of any element.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum