Document Width

webdevtips - Q1:How can I get the document width and height?[skip navigation] Loading - webdevtips - Q1:How can I get the document width and height? You are here : home / faq / javascript Q1. Thursday 20 March 2003 [See The Latest Site Updates][home][about andy] [contact] [questionnaire] [privacy] [site usage]

[code generators][metatagger] [click & go] [html writer] [lorem ipsum] [valid scroll] [window generator] [random number] [html 2 js] [email scrambler] [RSS headliner]

[web developer][html] [dhtml] [javascript] [cgi/perl] [asp] [includes] [style sheets] [php] [webhosting]

resources[f-a-q] [resource directory] [modem speed test] [window test] [browser upgrade] [webdevtips store] [news headlines] [web directory] [link to webdevtips] [site index]

search webdevtips

shop search

category books e-books electronics video games software

[]

[]

[]

webdevtips storebooks [Apache] [A S P] [CSS] [Dynamic HTML] [HTML] [Internet] [Javascript] [Linux] [Mac OS] [Microsoft] [Perl] [Photoshop] [P H P] [Python] [Web Accessibility] [Web Security] [Web Usability] [WWW] [XHTML] [XML ]

[more books]

software [Anti Virus] [Back-Up] [Database] [Operating Systems] [Security] [Visual Basic] [Web Development] [Web Graphics] [Web Programming]

[more software]

computer [Peripherals] [Video Games]

shop search : category books e-books electronics video games software

please read this FAQ Q1:How can I get the document width and height?

A: Internet Explorer - use (document.body.clientWidth - document.body.clientHeight)

Mozilla - use (document.body.clientWidth - document.body.clientHeight) or (window.innerWidth - window.innerHeight)

Netscape 4x - use (window.innerWidth - window.innerHeight) Netscape 6 - use (window.innerWidth - window.innerHeight)

Opera - use (window.innerWidth - window.innerHeight)

The best thing to do is object detect

//opera Netscape 6 Netscape 4x Mozilla if (window.innerWidth || window.innerHeight){ docwidth = window.innerWidth; docheight = window.innerHeight; } //IE Mozilla if (document.body.clientWidth || document.body.clientHeight){ docwidth = document.body.clientWidth; docheight = document.body.clientHeight; }

Test It Here

back to faq

back to top of page

Hosting sponsored by Funio.com Affordable, reliable web hosting solution with FREE domain registraion

copyright © webdevtips.com 1999/2003