英[kl??zd] 美[klo?zd]

adj. Closed, closed; airtight, confidential; <US> ready, contracted

v.The past tense and past participle of “close”

javascript closed attribute syntax

Function: Returns a Boolean value that declares whether the window has been closed. This property is read-only. When the browser window is closed, the Windows object representing the window does not disappear, it will continue to exist, but its closed property will be set to true.

Syntax: window.closed

javascript closed attribute example

<html>
<head>
<script type="text/javascript">
function ifClosed()
  {
  document.write("窗口已關(guān)閉")
  }
  
function ifNotClosed()
  {
  document.write("窗口沒有關(guān)閉")
  }

function checkWin()
  {
  if (myWindow.closed)
    ifClosed()
  else
    ifNotClosed()
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("這是打開的窗口")
</script>

<input type="button" value="窗口是否已經(jīng)關(guān)閉?" onclick="checkWin()">
<p>注釋:請(qǐng)開啟瀏覽器的彈窗操作權(quán)限</p>
</body>
</html>

Run instance ?

Click the "Run instance" button to view the online instance