// function to get the current width of the window
function getWidth(){
var x = 0;
if (self.innerHeight){
x = self.innerWidth;
}else if (document.documentElement && document.documentElement.clientHeight){
x = document.documentElement.clientWidth;
}else if (document.body){
x = document.body.clientWidth;
}
return x;
}
// function to get the current height of the window
function getHeight(){
var y = 0;
if (self.innerHeight){
y = self.innerHeight;
}else if (document.documentElement && document.documentElement.clientHeight){
y = document.documentElement.clientHeight;
}else if (document.body){
y = document.body.clientHeight;
}
return y;
}
Wednesday, January 14, 2009
Javascript: Getting Current Window Dimension
Javascript function to get current window height and width. Works with most of the browsers.
Subscribe to:
Post Comments (Atom)
Back to Blogging
After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...
-
For my Univ project, I need 2 use graphics.h. Everyone knows graphics.h is not in C's standard library. Only Turbo C supports it and for...
-
Make sure you have grub installed in the same partition as the Ubuntu, not in MBR. Now boot into any linux Live CD and do this: $sudo dd if=...
-
Normally, when we are coding java in Eclipse , we do not see any javadoc help when we hover over a keyword. This is because by default, ecli...
No comments:
Post a Comment