closed 属性可返回一个布尔值,该值声明了窗口是否已经关闭。
window.closed
所有主要浏览器都支持 closed 属性
检测新窗口"myWindow" 是否已被关闭:
运行一下 »function checkWin()
{
if (!myWindow)
{
document.getElementById("msg").innerHTML="'myWindow' has never been opened!";
}
else
{
if (myWindow.closed)
{
document.getElementById("msg").innerHTML="'myWindow' has been closed!";
}
else
{
document.getElementById("msg").innerHTML="'myWindow' has not been closed!";
}
}
}