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


复制代码 代码如下:

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

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3