最新的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

技術細節

返回值: 布爾,真如果窗口已經關閉,或假,如果窗口開啟

<窗口對象