F
FAQ server
-----------------------------------------------------------------------
FAQ Topic - How do I find the size of a browser window?
-----------------------------------------------------------------------
Where supported in NN: (>NN4.0)
var winWidth = window.innerWidth;
var winHeight = window.innerHeight;
Where supported in IE: (>IE4.0)
var winWidth = document.body.clientWidth;
var winHeight = document.body.clientHeight;
When using IE6 with in CSS1Compat mode (with a Formal DOCTYPE):
var winWidth = document.documentElement.clientWidth
var winHeight = document.documentElement.clientHeight
Combined:
var winWidth, winHeight, d=document;
if (typeof window.innerWidth!='undefined') {
winWidth = window.innerWidth;
winHeight = window.innerHeight;
} else {
if (d.documentElement &&
typeof d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0) {
winWidth = d.documentElement.clientWidth
winHeight = d.documentElement.clientHeight
} else {
if (d.body &&
typeof d.body.clientWidth!='undefined') {
winWidth = d.body.clientWidth
winHeight = d.body.clientHeight
}
}
}
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientWidth.asp
http://docs.sun.com/source/816-6408-10/window.htm#1202446
http://msdn.microsoft.com/workshop/author/om/measuring.asp
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.
FAQ Topic - How do I find the size of a browser window?
-----------------------------------------------------------------------
Where supported in NN: (>NN4.0)
var winWidth = window.innerWidth;
var winHeight = window.innerHeight;
Where supported in IE: (>IE4.0)
var winWidth = document.body.clientWidth;
var winHeight = document.body.clientHeight;
When using IE6 with in CSS1Compat mode (with a Formal DOCTYPE):
var winWidth = document.documentElement.clientWidth
var winHeight = document.documentElement.clientHeight
Combined:
var winWidth, winHeight, d=document;
if (typeof window.innerWidth!='undefined') {
winWidth = window.innerWidth;
winHeight = window.innerHeight;
} else {
if (d.documentElement &&
typeof d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0) {
winWidth = d.documentElement.clientWidth
winHeight = d.documentElement.clientHeight
} else {
if (d.body &&
typeof d.body.clientWidth!='undefined') {
winWidth = d.body.clientWidth
winHeight = d.body.clientHeight
}
}
}
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientWidth.asp
http://docs.sun.com/source/816-6408-10/window.htm#1202446
http://msdn.microsoft.com/workshop/author/om/measuring.asp
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.