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>