js获取屏幕

js获取屏幕(设备)宽高
<script language="javascript">
var h = "";
h += " 网页可见区域宽:"+ document.body.clientWidth+"\n";
h += " 网页可见区域高:"+ document.body.clientHeight+"\n";
h += " 网页可见区域宽:"+ document.body.offsetWidth +" (包括边线和滚动条的宽)"+"\n";
h += " 网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)"+"\n";
h += " 网页正文全文宽:"+ document.body.scrollWidth+"\n";
h += " 网页正文全文高:"+ document.body.scrollHeight+"\n";
h += " 网页被卷去的上:"+ document.body.scrollTop+"\n";
h += " 网页被卷去的左:"+ document.body.scrollLeft+"\n";
h += " 网页正文部分上:"+ window.screenTop+"\n";
h += " 网页正文部分左:"+ window.screenLeft+"\n";
h += " 屏幕分辨率的宽:"+ window.screen.width+"\n";
h += " 屏幕分辨率的高:"+ window.screen.height+"\n";
h += " 屏幕可用工作区宽度:"+ window.screen.availWidth+"\n";
h += " 屏幕可用工作区高度:"+ window.screen.availHeight+"\n";
h += " 你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色"+"\n";
h += " 你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸"+"\n";
alert(h);
</script>

 

 
posted @ 2018-01-26 17:33  琼琼Daring  阅读(186)  评论(0编辑  收藏  举报