Detect the width of the browser window

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello.

how do you detect the width of the browser window with javascript?
thanks.
 
document.body.clientWidth

Why do you ask?

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
Now!
o--> Microsoft Office FrontPage 2003 Inside Out
o--> Microsoft Windows SharePoint Services Inside Out
o--> Faster Smarter Beginning Programming
 
i am asking because i want to adjust the size of the text on my site
according to the width of the browser window.

thanks!
 
Please don't.

Be a professional and make the site adjust to MY settings, not the other way
around. Most people I know hate when sites do that.
 
Your plan is doomed to fail because the visitor can resize the text anyway,
via View, Text Size. And while this doesn't affect text you size in px, in,
dm, mm, pt, or pc in IE, the corresponding command *does* resize those
measurements in Netscape, Forefox, and other browers.

The options under Tools, Internet Options, Accessability throw another
monkey wrench into your plans.

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
Now!
o--> Microsoft Office FrontPage 2003 Inside Out
o--> Microsoft Windows SharePoint Services Inside Out
o--> Faster Smarter Beginning Programming
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top