screen對象
screen
screen物件表示螢幕的訊息,常用的屬性有:
screen.width:螢幕寬度,以像素為單位;
screen.height:螢幕高度,以像素為單位;
screen.colorDepth:傳回顏色位數,如8、16、24。
<html> <head> <script> 'use strict'; alert('Screen size = ' + screen.width + ' x ' + screen.height); </script> </head> <body> </body> </html>
<!DOCTYPE html> <html> <body> <script> document.write("可用高度:" + screen.availHeight); </script> </body> </html>