Results 1 to 3 of 3

Thread: Get FF innerHeight without scrollbar height

  1. #1
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Get FF innerHeight without scrollbar height

    How do get innerHeight in FireFox without scrollbar height? Any suggestion

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Simple answer:

    Code:
    document.body.clientHeight
    But, that will do it in Opera 9 too as well as in IE without a DOCTYPE but, if you want it for all three with or without DOCTYPE and have it degrade where not supported:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    function getHeight(){
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body;
    }
    if(iecompattest().clientHeight)
    return iecompattest().clientHeight;
    else
    return null;
    }
    </script>
    </head>
    <body>
    <p style="width:125%;">&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <input type="button" onclick="alert(window.innerHeight);"><br>
    <input type="button" onclick="alert(getHeight());"><br>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, John.

Bookmarks

Posting Permissions

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