It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum Script-archive

Getting The Page Width & Height

Getting The Page Width & Height

Postby HotNoob on Fri Sep 24, 2010 4:53 pm

Code: Select all
function pageWidth()
    {
      return window.innerWidth != null? window.innerWidth :
      document.documentElement && document.documentElement.clientWidth ?
      document.documentElement.clientWidth : document.body != null ?
      document.body.clientWidth : null;
    }
function pageHeight()
    {
      return window.innerHeight != null? window.innerHeight :
      document.documentElement && document.documentElement.clientHeight ?
      document.documentElement.clientHeight : document.body != null ?
      document.body.clientHeight : null;
    }

These functions are compatible for all browsers (or at-least they were the last time a checked.)
HotNoob
100+ Club
 
Posts: 169
Joined: Sun May 02, 2010 1:38 am

Who is online

Users browsing this forum: No registered users and 0 guests