■モニタ画面のサイズと表示色数を参照したい


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>モニタ画面のサイズと表示色数を参照したい</title>
</head>
<body>
<p>■モニタ画面のサイズと表示色数を参照したい</p>
<p>
<script type="text/JavaScript">
<!--
document.write("screen.width = "+screen.width+" ピクセル<br>");
document.write("screen.height = "+screen.height+" ピクセル<br>");
document.write("screen.availWidth = "+screen.availWidth+" ピクセル<br>");
document.write("screen.availHeight = "+screen.availHeight+" ピクセル<br>");
document.write("screen.colorDepth = "+screen.colorDepth+" ビット");
if (screen.colorDepth == 32) {
document.write(" = "+Math.pow(2,24)+" 色表示");
} else {
document.write(" = "+Math.pow(2,screen.colorDepth)+" 色表示");
}
// -->
</script>
</p>
</body>
</html>


★解説★