日期:2014-05-16  浏览次数:20426 次

JS 常用功能(持续收集中)

1.获取各种相关分辨率:

<html>
<body>
<script LANGUGE="Javascript">
var s= "";
s += "<br>网页可见区域宽度:" +document.body.clientWidth;
s += "<br>网页可见区域高度:" +document.body.clientHeight;
s += "<br>网页可见区域宽度:" +document.body.offsetWidth+"(包括边线和滚动条)";
s += "<br>网页可见区域高度:" +document.body.offsetHeight+"(包括边线)";
s += "<br>网页正文全文宽:" +document.body.scrollWidth;
s += "<br>网页正文部分上:" +window.screenTop;
s += "<br>网页正文部分左:" +window.screenLeft;
s += "<br>屏幕分辨率高:" +window.screen.heiht;
s += "<br>屏幕分辨率宽:" +window.screen.width;
s += "<br>屏幕可用工作区高度:" +window.screen.availHeiht;
s += "<br>屏幕可用工作区宽度:" +window.screen.availWidth;
s += "<br>屏幕设置:" +window.screen.colorDepth+"位色彩";
s += "<br>屏幕设置:" +window.screen.deviceXDPI+"像素/英寸";
s += "<br>网页真实宽:" +document.documentElement.scrollWidth;
s += "<br>网页真实高:" +document.documentElement.scrollHeight;
document.write(s);
</script>
</body>
</html>

?