【JavaScript】 ウィンドウサイズに合わせて、id で指定した物の幅を変更する
iframeをいじる際にサイズ変更をしたかったので、探した時のメモ。
[body]を指定してるところがミソ。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>ToDo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8 " > </head> <body onresize="change()"> <script type="text/javascript"> <!-- function change(){ document.getElementById("google").style.height = document.body.clientHeight; document.getElementById("google").style.width = document.body.clientWidth; } // --> </script> <iframe ・・・ width="200" height="400" frameborder="0" scrolling="no" id="google"></iframe> </body> </html>