js获取浏览器高度 宽度
/**
*计算客户端高度
**/
function getWinHeight() {
if (window.innerHeight) {
return window.innerHeight;
}
if (document.compatMode === “CSS1Compat”) {
return window.document.documentElement.clientHeight;
}
return window.document.body.clientHeight;
};
/**
*计算客户端宽度
**/
function getWinWidth() {
if (window.innerWidth) {
return window.innerWidth;
}
if (document.compatMode === “CSS1Compat”) {
return window.document.documentElement.clientWidth;
}
return window.document.body.clientWidth;
};
还没有评论,来说两句吧...