最新的Web开发教程
 

Window closed Property

<窗口对象

它检查了一个名为窗口是否函数"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!";
          }
    }
}
试一试»

定义和用法

封闭属性返回一个布尔值,指示窗口是否已关闭或没有。


浏览器支持

属性
closed

句法

window.closed

技术细节

返回值: 布尔,真如果窗口已经关闭,或假,如果窗口开启

<窗口对象