Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











PROPERTY:  Window::closed


window.closed

This property is used to return a Boolean value that determines if a window has been closed. If it has, the value returned is true.

The following code opens a new window and then immediately closes it. The onClick event of the button then calls a function which uses the window.closed property to display the status (open or closed) of the window.

Code:
<INPUT TYPE="Button" NAME="winCheck" VALUE="Has window been closed?" onClick=checkIfClosed()>

newWindow=window.open('','','toolbar=no,scrollbars=no,width=300,height=150')
newWindow.document.write("This is 'newWindow'")
newWindow.close()

function ifClosed() {
document.write("The window 'newWindow' has been closed")
}

function ifNotClosed() {
document.write("The window 'newWindow' has not been closed")
}

function checkIfClosed() {
if (newWindow.closed)
   ifClosed()
else
   ifNotClosed()
}

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information