height只读属性返回像素屏幕的总高度。
使用width属性获取屏幕的总宽度(以像素为单位)。
screen.height
var x = "Total Height: " + screen.height;测试看看‹/›
所有浏览器完全支持height属性:
属性 | |||||
height | 是 | 是 | 是 | 是 | 是 |
返回值: | 一个数字,表示用户屏幕的总高度,以像素为单位 |
---|
此示例显示所有屏幕属性:
var txt = ""; txt += "<p>Total width/height: " + screen.width + "*" + screen.height + "</p>"; txt += "<p>Available width/height: " + screen.availWidth + "*" + screen.availHeight +"</p>"; txt += "<p>Color depth: " + screen.colorDepth + "</p>"; txt += "<p>Color resolution: " + screen.pixelDepth + "</p>"; document.write(txt);测试看看‹/›
screen参考:screen.availHeight属性
screen参考:screen.availWidth属性
screen参考:screen.colorDepth属性
screen参考:screen.width属性
screen参考:screen.pixelDepth属性