JavaScriptのサンプル
ブラウザの表示領域(各種バーを含まない領域)を表示するスクリプトです。
コード
<html>
<head>
<title>TAG index Webサイト</title>
</head>
<body>
<script type="text/javascript">
<!--
if(document.all){ // 古いIE用
// 互換モードの場合はこちらを使用
document.write('<p>横のサイズ:<b>' + document.body.clientWidth + '</b><br>');
document.write('縦のサイズ:<b>' + document.body.clientHeight + '</b></p>');
// 標準モードの場合はこちらを使用
// document.write('<p>横のサイズ:<b>' + document.documentElement.clientWidth + '</b><br>');
// document.write('縦のサイズ:<b>' + document.documentElement.clientHeight + '</b></p>');
}
else{
document.write('<p>横のサイズ:<b>' + innerWidth + '</b><br>');
document.write('縦のサイズ:<b>' + innerHeight + '</b></p>');
}
// -->
</script>
</body>
</html>
解説
表示したい場所にスクリプトを記述します。
ブラウザの縦と横のサイズを取得して表示します。
青い文字の部分は、必要に応じて書き換えてください。