Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Javascript only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
Javascript
window width and height
Collapse
This topic is closed.
X
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Bern
#1
window width and height
Jul 23 '05, 02:42 PM
how to get the width and height of the visible window in IE, netscape and
mozilla?
Andrew Thompson
#2
Jul 23 '05, 02:42 PM
Re: window width and height
On Fri, 15 Oct 2004 21:01:41 +0800, Bern wrote:
[color=blue]
> how to get the width and height of the visible window in IE, netscape and
> mozilla?[/color]
<script type='text/javascript'>
var viewWidth;
var viewHeight;
function determineViewab leSize() {
d=document;
if (typeof window.innerWid th!='undefined' ) {
viewWidth = window.innerWid th;
viewHeight = window.innerHei ght;
} else {
if (d.documentElem ent &&
typeof d.documentEleme nt.clientWidth! ='undefined' &&
d.documentEleme nt.clientWidth! =0) {
viewWidth = d.documentEleme nt.clientWidth
viewHeight = d.documentEleme nt.clientHeight
} else {
if (d.body &&
typeof d.body.clientWi dth!='undefined ') {
viewWidth = d.body.clientWi dth
viewHeight = d.body.clientHe ight
}
}
}
}
function getViewableWidt h() {
if (!viewWidth) determineViewab leSize();
return viewWidth;
}
function getViewableHeig ht() {
if (!viewHeight) determineViewab leSize();
return viewHeight;
}
function viewableSize() {
return "<b>Viewabl e</b> size: " +
getViewableWidt h() + "x" + getViewableHeig ht() + ".";
}
</script>
HTH
--
Andrew Thompson
http://www.PhySci.org/codes/
Web & IT Help
http://www.PhySci.org/
Open-source software suite
http://www.1point1C.org/
Science & Technology
http://www.lensescapes.com/
Images that escape the mundane
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment