screen

書式

screen.プロパティ

説明

モニタ画面の情報を保持するオブジェクトです。ブラウザによりサポートされているプロパティ/メソッド/イベントが異なるので注意が必要です。新しいブラウザではscreenオブジェクトはwindowオブジェクトの配下に設置されています。また、以下のサンプルを実行してもWindows版Internet Explorer6やSafari 2では何も表示されません。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript"><!--
window.onload = function() {
var txt = "";
for (i in screen) {
try {
txt += i+" = "+screen[i]+"<br>";
}catch(e){}
}
document.getElementById("result").innerHTML = txt;
}
// --></script>
</head>
<body>
<div id="result"></div>
</body>
</html>