1. 程式人生 > >獲取瀏覽器可見高度

獲取瀏覽器可見高度

就一句話 top.innerheight

之所以在此記錄一下  是因為網上別的資訊很是不準確

下面是在別處複製的內容   供參考   

JS獲取螢幕高度var s = "";
s += " 網頁可見區域寬:"+ document.body.clientWidth;
s += " 網頁可見區域高:"+ document.body.clientHeight;
s += " 網頁可見區域寬:"+ document.body.offsetWidth +" (包括邊線和滾動條的寬)";
s += " 網頁可見區域高:"+ document.body.offsetHeight +" (包括邊線的寬)";
s += " 網頁正文全文寬:"+ document.body.scrollWidth;
s += " 網頁正文全文高:"+ document.body.scrollHeight;
s += " 網頁被捲去的高:"+ document.body.scrollTop;
s += " 網頁被捲去的左:"+ document.body.scrollLeft;
s += " 網頁正文部分上:"+ window.screenTop;
s += " 網頁正文部分左:"+ window.screenLeft;
s += " 螢幕解析度的高:"+ window.screen.height;
s += " 螢幕解析度的寬:"+ window.screen.width;
s += " 螢幕可用工作區高度:"+ window.screen.availHeight;
s += " 螢幕可用工作區寬度:"+ window.screen.availWidth;
s += " 你的螢幕設定是 "+ window.screen.colorDepth +" 位彩色";
s += " 你的螢幕設定 "+ window.screen.deviceXDPI +" 畫素/英寸";