function getWinSize(){
var winWidth =null;//宽度
var winHeight =null;//高度
if(window.innerWidth)
winWidth = window.innerWidth;
else if(document.body && document.body.clientWidth)
winWidth = document.body.clientWidth;
if(window.innerHeight)
winHeight = window.innerHeight;
else if(document.body && document.body.clientHeight)
winHeight = document.body.clientHeight;
//深入页面内部获取
if(document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight){
winWidth = document.documentElement.clientWidth;
winHeight = document.documentElement.clientHeight;
}
return {width:winWidth,height:winHeight};
}js获取页面窗口大小
原文:http://blog.csdn.net/yo_yolv/article/details/45568317