js 判斷 螢幕大小
阿新 • • 發佈:2019-01-27
<html>
<script>
function a(){
document.write(
"螢幕解析度為:"+screen.width+"*"+screen.height
+"<br />"+
"螢幕可用大小:"+screen.availWidth+"*"+screen.availHeight
+"<br />"+
"網頁可見區域寬:"+document.body.clientWidth
+"<br />"+
"網頁可見區域高:"+document.body.clientHeight
+"<br />"+
"網頁可見區域寬(包括邊線的寬):"+document.body.offsetWidth
+"<br />"+
"網頁可見區域高(包括邊線的寬):"+document.body.offsetHeight
+"<br />"+
"網頁正文全文寬:"+document.body.scrollWidth
+"<br />"+
"網頁正文全文高:"+document.body.scrollHeight
+"<br />"+
"網頁被捲去的高:"+document.body.scrollTop
+"<br />"+
"網頁被捲去的左:"+document.body.scrollLeft
+"<br />"+
"網頁正文部分上:"+window.screenTop
+"<br />"+
"網頁正文部分左:"+window.screenLeft
+"<br />"+
"螢幕解析度的高:"+window.screen.height
+"<br />"+
"螢幕解析度的寬:"+window.screen.width
+"<br />"+
"螢幕可用工作區高度:"+window.screen.availHeight
+"<br />"+
"螢幕可用工作區寬度:"+window.screen.availWidth
);
}
</script>
<body onload="a()" >
</body>
</html>
<script>
function a(){
document.write(
"螢幕解析度為:"+screen.width+"*"+screen.height
+"<br />"+
"螢幕可用大小:"+screen.availWidth+"*"+screen.availHeight
+"<br />"+
"網頁可見區域寬:"+document.body.clientWidth
+"<br />"+
"網頁可見區域高:"+document.body.clientHeight
+"<br />"+
"網頁可見區域寬(包括邊線的寬):"+document.body.offsetWidth
+"<br />"+
"網頁可見區域高(包括邊線的寬):"+document.body.offsetHeight
+"<br />"+
"網頁正文全文寬:"+document.body.scrollWidth
+"<br />"+
"網頁正文全文高:"+document.body.scrollHeight
+"<br />"+
"網頁被捲去的高:"+document.body.scrollTop
+"<br />"+
"網頁被捲去的左:"+document.body.scrollLeft
+"<br />"+
"網頁正文部分上:"+window.screenTop
+"<br />"+
"網頁正文部分左:"+window.screenLeft
+"<br />"+
"螢幕解析度的高:"+window.screen.height
+"<br />"+
"螢幕解析度的寬:"+window.screen.width
+"<br />"+
"螢幕可用工作區高度:"+window.screen.availHeight
+"<br />"+
"螢幕可用工作區寬度:"+window.screen.availWidth
);
}
</script>
<body onload="a()" >
</body>
</html>