|
-
Jan 26th, 2003, 11:15 PM
#1
Thread Starter
New Member
Can you use javascript to find the height of a window? *Resolved*
Hello,
I am very new to javascript, so this is why I am asking a question that is probably very basic. I apologize for this...
Anyway, I am writing a web page where I need to find the height of the window. How would I go about doing this? Is it possible to do this without opening a new window?
Thank you very much for your assistance.
Last edited by gertj; Jan 27th, 2003 at 10:01 PM.
-
Jan 27th, 2003, 12:58 AM
#2
Code:
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth;
winH = window.innerHeight;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
document.write(
"Window width = "+winW+"<br>"
+"Window height = "+winH
)
To adjust the width and height values taking into accout the scrollbars in Netscape Navigator: subtract 16 from the width and height and in Microsoft Internet Explorer: subtract 20 from the width and height
source
-
Jan 27th, 2003, 10:02 PM
#3
Thread Starter
New Member
Thanks
Thanks for the help! I appreciate it very much.
-
Jan 28th, 2003, 01:36 AM
#4
YW
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|