closed

Window closed 属性


定义和用法

closed 属性可返回一个布尔值,该值声明了窗口是否已经关闭。

语法

window.closed


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 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!";
  }
  }
}

© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3