当前位置:Gxlcms > JavaScript > 基于jquery的获取浏览器窗口大小的代码

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

时间:2021-07-01 10:21:17 帮助过:2人阅读

代码如下:

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);

人气教程排行