ブラウザの表示領域(各種バーを含まない領域)を表示するスクリプトです。
<html> <head> <title>HTML index Webサイト</title> </head> <body> <script type="text/javascript"> <!-- if(document.all){ // IE用 document.write('<p>横のサイズ:<strong>' + document.body.clientWidth + '</strong><br>'); document.write('縦のサイズ:<strong>' + document.body.clientHeight + '</strong></p>'); } else{ document.write('<p>横のサイズ:<strong>' + innerWidth + '</strong><br>'); document.write('縦のサイズ:<strong>' + innerHeight + '</strong></p>'); } // --> </script> </body> </html>
表示したい場所にスクリプトを記述します。
ブラウザの縦と横のサイズを取得して表示します。
※サイズの取得方法はIEとそれ以外では異なります。
青い文字の部分は、必要に応じて書き換えてください。