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 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Window "inner" width and height

    Is there a way to find the "inner" width and height of a window, without all the menu bars, tool bars, status lines, buttons, etc.

    I would like just the available real estate for my graphics.

    Thanks!

    William

  • #2
    Regular Coder ghostz00's Avatar
    Join Date
    Aug 2006
    Posts
    128
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Not sure if this is the best way to do it, but try this.

    Code:
    html_tag=document.body.parentNode;
    html_tag.clientWidth;
    html_tag.clientHeight;
    works in ie 6/7, firefox
    Greg

  • #3
    New Coder
    Join Date
    Apr 2008
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That's a neat trick, but...

    It returns the BODY width & height, which is not the "visible" usable document area inside the browser window (minus toolbars, status bar, etc)

    In my case, the body is larger than the window.

  • #4
    Regular Coder ghostz00's Avatar
    Join Date
    Aug 2006
    Posts
    128
    Thanks
    11
    Thanked 2 Times in 2 Posts
    It shouldn't return the body.

    It should return the body's parent node which is html.

    html_tag=document.body.parentNode;


    why don't you post the code?
    Greg


  •  

    Posting Permissions

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