Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Location
    Brazil
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding page height

    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ć

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    did you try: document.height ????

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Location
    Brazil
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes. if I put it in an alert, IE says 'undefined' and Moz says '0'.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    document.body.clientHeight

    Hope that helps!

    Happy coding!

  • #5
    New to the CF scene
    Join Date
    Jun 2004
    Location
    Brazil
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #7
    Regular Coder
    Join Date
    Feb 2004
    Location
    WA
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Nobody is Perfect. I am Nobody.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •