screen對象
screen
screen物件表示螢?zāi)坏挠嵪?,常用的屬性有?/p>
screen.width:螢?zāi)粚挾?,以像素為單位?/p>
screen.height:螢?zāi)桓叨?,以像素為單位?/p>
screen.colorDepth:傳回顏色位數(shù),如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>