英[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("窗口已关闭") } function ifNotClosed() { document.write("窗口没有关闭") } 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="窗口是否已经关闭?" onclick="checkWin()"> <p>注释:请开启浏览器的弹窗操作权限</p> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance