標籤:style blog http color java ar div log sp
1 <SCRIPT LANGUAGE="JavaScript"> 2 var s = "網頁可見地區寬:"+ document.body.clientWidth; 3 s += "\r\n網頁可見地區高:"+ document.body.clientHeight; 4 s += "\r\n網頁可見地區高:"+ document.body.offsetWeight +" (包括邊線的寬)"; 5 s += "\r\n網頁可見地區高:"+ document.body.offsetHeight +" (包括邊線的寬)"; 6 s += "\r\n網頁本文全文寬:"+ document.body.scrollWidth; 7 s += "\r\n網頁本文全文高:"+ document.body.scrollHeight; 8 s += "\r\n網頁被捲去的高:"+ document.body.scrollTop; 9 s += "\r\n網頁被捲去的左:"+ document.body.scrollLeft; 10 s += "\r\n網頁本文部分上:"+ window.screenTop; 11 s += "\r\n網頁本文部分左:"+ window.screenLeft; 12 s += "\r\n螢幕解析度的高:"+ window.screen.height; 13 s += "\r\n螢幕解析度的寬:"+ window.screen.width; 14 s += "\r\n螢幕可用工作區高度:"+ window.screen.availHeight; 15 s += "\r\n螢幕可用工作區寬度:"+ window.screen.availWidth; 16 alert(s); 17 </SCRIPT>
轉載自http://blog.163.com/[email protected]/blog/static/37430915201031734726319/,感謝分享
js得到當前視窗內的寬度和高度