top、client、scroll、offset四者的區別

 
示列代碼:
 
<html>
<head>
<title>51windows.Net </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
var  s = "";
s += "\r\n網頁可見區域寬:"+ document.body.clientWidth;
s += "\r\n網頁可見區域高:"+ document.body.clientHeight;
s += "\r\n網頁可見區域寬:"+ document.body.offsetWidth  +" (包括邊線的寬)";
s += "\r\n網頁可見區域高:"+ document.body.offsetHeight +" (包括邊線的寬)";
s += "\r\n網頁正文全文寬:"+ document.body.scrollWidth;
s += "\r\n網頁正文全文高:"+ document.body.scrollHeight;
s += "\r\n網頁被捲去的高:"+ document.body.scrollTop;
s += "\r\n網頁被捲去的左:"+ document.body.scrollLeft;
s += "\r\n網頁正文部分上:"+ window.screenTop;
s += "\r\n網頁正文部分左:"+ window.screenLeft;
s += "\r\n屏幕分辨率的高:"+ window.screen.height;
s += "\r\n屏幕分辨率的寬:"+ window.screen.width;
s += "\r\n屏幕可用工做區高度:"+ window.screen.availHeight;
s += "\r\n屏幕可用工做區寬度:"+ window.screen.availWidth;
alert(s);
</SCRIPT>
</body>
</html>

0javascript

收藏css

kiddymeet

170篇文章,202W+人氣,1粉絲

Ctrl+Enter 發佈html

發佈java

取消mysql

掃一掃,領取大禮包jquery

0linux

3
分享
kiddymeet
相關文章
相關標籤/搜索