JavaScript Windowが未だ開いているか
ナビゲーションに移動
検索に移動
JavaScript Windowが未だ開いているか
<html> <head> <script> var winobj; var check_cnt = 1; var timerId; function openLink( url ) { var winname = "dummy"; winobj = window.open(url, winname); timerId = window.setInterval(checkStatus, 1000); } function checkStatus() { var area = document.getElementById("win_status"); var isClosed = false; try { isClosed = winobj.closed; } catch(e) { isClosed = true; } if (isClosed) { window.clearInterval(timerId); } var winStatus = (isClosed)?"CLOSED": "OPEN"; area.innerHTML = "確認回数(1.0秒毎) : " + (check_cnt++) + "回, Windouwの状態 :" + winStatus; } </script> </head> <body>
<a href="javascript:openLink('http://google.co.jp');">google</a> </body> </html>
© 2006 矢木浩人