Screen colorDepth 屬性

定義和用法
colorDepth 屬性返回目標(biāo)設(shè)備或緩沖器上的調(diào)色板的比特深度。
語(yǔ)法
screen.colorDepth
瀏覽器支持
所有主要瀏覽器都支持 colorDepth 屬性
實(shí)例s
實(shí)例 1
返回調(diào)色板的位深度:
<script>
document.write("顏色深度: " + screen.colorDepth);
</script>
document.write("顏色深度: " + screen.colorDepth);
</script>
以上實(shí)例輸出結(jié)果:
document.write("顏色深度: " + screen.colorDepth);
嘗試一下 ?
實(shí)例 2
在8比特屏顯示交替的背景顏色:
if (screen.colorDepth<=8)
//為8位屏幕的簡(jiǎn)單的藍(lán)色背景色
document.body.style.background="#0000FF"
else
//為現(xiàn)代屏幕的華麗的藍(lán)色背景色
document.body.style.background="#87CEFA"
//為8位屏幕的簡(jiǎn)單的藍(lán)色背景色
document.body.style.background="#0000FF"
else
//為現(xiàn)代屏幕的華麗的藍(lán)色背景色
document.body.style.background="#87CEFA"
嘗試一下 ?

更多實(shí)例

更多建議: