在javascript中得到當前視窗的高和寬
<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;
s += "\r\n你的螢幕設定是 "+ window.screen.colorDepth +" 位彩色";
s += "\r\n你的螢幕設定 "+ window.screen.deviceXDPI +" 像素/英寸";
alert(s);