Login

Save Password - Forgot Pass?
Not a member?
Become a DC
member now!



         Document size
  • Screen height and width
  • Document height and width
  • lib_doc_size object
      Rate this tutorial:
    This tutorial have been read 29207 times.

    Print-friendly version

  • Document size
    Written 07/03/2001 by Thomas Brattli. Last updated 07/10/2001.


    Screen height and width

    To get the screen size and width we just use the existing screen object like this:

    bwidth=screen.width
    bheight=screen.height
    
    If we then write out that info:
    document.write("You have screen resolution:" + bwidth 
    + "x" +bheight) 
    
    We'll get this result:
    As you can see, this is correct, and good and well. This can for instance be used for opening a new window with the same size as the screen to cover up the screen (which is really annoying). But you can't really trust these figures when it comes to available document size, most users with big monitors almost never surf with their browserwindow maximized. You can also never know what toolbars the user has. So, we have to get the exact document size, not the screen size.

    Document height and width »

    Copyright ©2000-2002 DHTMLCentral.com, Bratta Communications. All rights reserved.