javascript小技巧之一【获取各种尺寸】

function ShowClientSize() {
var strText;
strText
= "网页可见区域宽:" + document.body.clientWidth;
strText
+= "\r\n网页可见区域高:" + document.body.clientHeight;
strText
+= "\r\n网页可见区域高:" + document.body.offsetWeight + " (包括边线的宽)";
strText
+= "\r\n网页可见区域高:" + document.body.offsetHeight + " (包括边线的宽)";
strText
+= "\r\n网页正文全文宽:" + document.body.scrollWidth;
strText
+= "\r\n网页正文全文高:" + document.body.scrollHeight;
strText
+= "\r\n网页被卷去的高:" + document.body.scrollTop;
strText
+= "\r\n网页被卷去的左:" + document.body.scrollLeft;
strText
+= "\r\n网页正文部分上:" + window.screenTop;
strText
+= "\r\n网页正文部分左:" + window.screenLeft;
strText
+= "\r\n屏幕分辨率的高:" + window.screen.height;
strText
+= "\r\n屏幕分辨率的宽:" + window.screen.width;
strText
+= "\r\n屏幕可用工作区高度:" + window.screen.availHeight;
strText
+= "\r\n屏幕可用工作区宽度:" + window.screen.availWidth;
alert(strText);
}
原文地址:https://www.cnblogs.com/alex_c/p/1954988.html