首页 > 语言 > JavaScript > 正文

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

2024-05-06 14:25:03
字体:
来源:转载
供稿:网友
代码如下:
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);
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选