Window screen.pixelDepth 屬性
- 上一頁 height
- 下一頁 width
- 返回上一層 Window Screen
定義和用法
pixelDepth
屬性返回屏幕的顏色深度。
pixelDepth
屬性返回以每像素位數為單位的顏色深度。
pixelDepth
屬性是只讀的。
另請參閱:
screen.colorDepth 屬性
提示:
Internet Explorer 9 及更早版本不支持 pixelDepth
屬性。
但是,pixelDepth
和 colorDepth
返回相同的值。
由于所有瀏覽器都支持 colorDepth
,請改用該屬性。
實例
例子 1
獲取屏幕的顏色分辨率:
let depth = screen.pixelDepth;
例子 2
所有屏幕屬性:
let text = "Total width/height: " + screen.width + "*" + screen.height + "<br>" + "Available width/height: " + screen.availWidth + "*" + screen.availHeight + "<br>" + "Color depth: " + screen.colorDepth + "<br>" + "Color resolution: " + screen.pixelDepth;
語法
screen.pixelDepth
返回值
類型 | 描述 |
---|---|
數字 |
每像素位的顏色分辨率: 1, 4, 8, 15, 16, 24, 32, 或 48。 |
瀏覽器支持
所有瀏覽器都支持 screen.pixelDepth
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
- 上一頁 height
- 下一頁 width
- 返回上一層 Window Screen