Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window Height, Width

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi!!
I've a question:
How do I get the width and height values of my window...
It should also works if you resize it...

Thank you
 
var width = 640, height = 480; // defaults
if (document.layers) {
width = window.innerWidth;
height = window.innerHeight;
}
else if (document.all) {
width = document.body.clientWidth;
height = document.body.clientHeight;
} It's not a lie if YOU believe it ;-)
 
Just wanted to add to my previous post that the first check is to detect NS4+ and the second one to detect IE4+ :) It's not a lie if YOU believe it ;-)
 
The first check's condition should be:[COLOR=aa0000]
Code:
if (!isNaN(window.innerHeight))
[/color]
That's because there are other browsers, such as Opera and Netscape 6 that don't support [COLOR=aa0000]
Code:
document.layers
[/color] but that do support [COLOR=aa0000]
Code:
innerHeight
[/color] and [COLOR=aa0000]
Code:
innerWidth
[/color].
Code:
- UNIMENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top