我刚写完。贴出来大家一起努力。<script type="text/javascript">
<!--
var win1 function winOpen()
{
win1 = window.open('a.htm','','width=300px,height=200px');
}function theIf(){ if (win1.closed)
{
alert("winclosed");
}
else
{
alert("winopen");
}
-->
</script>
调用 theIf() 函数,就可以判断 a.htm 窗口现在的状态。
<!--
var win1 function winOpen()
{
win1 = window.open('a.htm','','width=300px,height=200px');
}function theIf(){ if (win1.closed)
{
alert("winclosed");
}
else
{
alert("winopen");
}
-->
</script>
调用 theIf() 函数,就可以判断 a.htm 窗口现在的状态。
上面的 function theIf()少了一个 } 在最后,你自己填上就行了。复制时出错了。
alert("winclosed");
}
else{
alert("winopen");
} }}
win=window.open('myweb.htm','winname');
</script>
<input type="button" value="Check"
onclick="if(win.closed)alert('win关闭了')">