JavaScript Screenオブジェクト

ScreenオブジェクトはWindowオブジェクトの一部であり、window.screenプロパティを通じてアクセスできる。

目次

  1. プロパティ
    1. availHeight
    2. availWidth
    3. colorDepth
    4. height
    5. pixelDepth
    6. width

Screenオブジェクトのプロパティ

Screenオブジェクトのプロパティ
プロパティ 説明
availHeight スクリーンの高さ(ウィンドウのタスクバーを除く)
availWidth スクリーンの幅(ウィンドウのタスクバーを除く)
colorDepth イメージ表示のための色パレットのビット輝度
height スクリーン全体の高さ
pixelDepth スクリーンの解像度(ピクセルあたりのビット数)
width スクリーン全体の幅

screen.availHeight

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

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

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

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

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

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 =