基于jquery的获取浏览器窗口大小的代码

 更新时间:2011年03月28日 18:49:14   作者:  
今天正好用到这个,就网上搜了搜,贴出来了。需要的朋友可以参考下。
复制代码 代码如下:

function getTotalHeight(){
if($.browser.msie){
return document.compatMode == "CSS1Compat"? document.documentElement.clientHeight : document.body.clientHeight;
}
else {
return self.innerHeight;
}
}

function getTotalWidth (){
if($.browser.msie){
return document.compatMode == "CSS1Compat"? document.documentElement.clientWidth : document.body.clientWidth;
}
else{
return self.innerWidth;
}
}

var do_height = getTotalHeight();
var do_width = getTotalWidth();
alert("do_height=="+do_height+"\ndo_width=="+do_width);

相关文章

最新评论