ScreenオブジェクトはWindowオブジェクトの一部であり、window.screenプロパティを通じてアクセスできる。
プロパティ | 説明 |
---|---|
availHeight | スクリーンの高さ(ウィンドウのタスクバーを除く) |
availWidth | スクリーンの幅(ウィンドウのタスクバーを除く) |
colorDepth | イメージ表示のための色パレットのビット輝度 |
height | スクリーン全体の高さ |
pixelDepth | スクリーンの解像度(ピクセルあたりのビット数) |
width | スクリーン全体の幅 |
screen.availHeight は、スクリーンの高さ(ウィンドウのタスクバーを除く)を示すプロパティである。
<p>screen.availHeight = <span id="availHeight"></span></p>
<script>
try {
document.getElementById("availHeight").innerHTML = screen.availHeight;
} catch(e) {
console.error(e.message);
}
</script>
screen.availHeight =
screen.availWidth は、スクリーンの幅(ウィンドウのタスクバーを除く)を示すプロパティである。
<p>screen.availWidth = <span id="availWidth"></span></p>
<script>
try {
document.getElementById("availWidth").innerHTML = screen.availWidth;
} catch(e) {
console.error(e.message);
}
</script>
screen.availWidth =
screen.colorDepth は、イメージ表示のための色パレットのビット輝度を示すプロパティである。
<p>screen.colorDepth = <span id="colorDepth"></span></p>
<script>
try {
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
} catch(e) {
console.error(e.message);
}
</script>
screen.colorDepth =
screen.height は、スクリーン全体の高さを示すプロパティである。
<p>screen.height = <span id="height"></span></p>
<script>
try {
document.getElementById("height").innerHTML = screen.height;
} catch(e) {
console.error(e.message);
}
</script>
screen.height =
screen.pixelDepth は、スクリーンの解像度(ピクセルあたりのビット数)を示すプロパティである。
<p>screen.pixelDepth = <span id="pixelDepth"></span></p>
<script>
try {
document.getElementById("pixelDepth").innerHTML = screen.pixelDepth;
} catch(e) {
console.error(e.message);
}
</script>
screen.pixelDepth =
screen.width は、スクリーン全体の幅を示すプロパティである。
<p>screen.width = <span id="width"></span></p>
<script>
try {
document.getElementById("width").innerHTML = screen.width;
} catch(e) {
console.error(e.message);
}
</script>
screen.width =