JS返回網頁的高和寬

   var strInfo=""
   strInfo
+="\r\n網頁可見區域寬:"+document.body.clientWidth; 
   strInfo
+="\r\n網頁可見區域高:"+document.body.clientHeight; 
   strInfo
+="\r\n網頁可見區域寬:"+document.body.offsetWidth+"(包括邊線的寬)"
   strInfo
+="\r\n網頁可見區域高:"+document.body.offsetHeight+"(包括邊線的寬)"
   strInfo
+="\r\n網頁正文全文寬:"+document.body.scrollWidth; 
   strInfo
+="\r\n網頁正文全文高:"+document.body.scrollHeight; 
   strInfo
+="\r\n網頁被捲去的高:"+document.body.scrollTop; 
   strInfo
+="\r\n網頁被捲去的左:"+document.body.scrollLeft; 
   strInfo
+="\r\n網頁正文部分上:"+window.screenTop; 
   strInfo
+="\r\n網頁正文部分左:"+window.screenLeft; 
   strInfo
+="\r\n屏幕分辨率的高:"+window.screen.height; 
   strInfo
+="\r\n屏幕分辨率的寬:"+window.screen.width; 
   strInfo
+="\r\n屏幕可用工作區高度:"+window.screen.availHeight; 
   strInfo
+="\r\n屏幕可用工作區寬度:"+window.screen.availWidth; 
   window.confirm(strInfo);

申明

非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!

博文欢迎转载,但请给出原文连接。

原文地址:https://www.cnblogs.com/Athrun/p/1262194.html