JavaScript Tips


ディスプレイサイズの取得


画面の解像度を取得するサンプルです。取得できる数値の単位はpixelです。
<SCRIPT language="JavaScript">
<!--

document.write("スクリーンの幅:"+screen.width);
document.write("<BR>");

document.write("スクリーンの高さ:"+screen.height);
document.write("<BR>");

document.write("有効なスクリーンの幅:"+screen.availwidth);
document.write("<BR>");

document.write("有効なスクリーンの高さ:"+screen.availheight);
document.write("<BR>");

//-->
</SCRIPT>