closed property (window)
Returns a Boolean value that indicates whether the window is closed or not.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
Boolean, one of the following values:
The window is open. | |||||||
The window is closed. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the closed property:
|
||||
<head> <script type="text/javascript"> var testWindow = null; function OpenTestWindow () { if (!testWindow || testWindow.closed) { testWindow = window.open ("", "testWindow", "width=250, height=150, left=10, top=10"); } } function IsTestWindowClosed () { if (testWindow) { if (testWindow.closed) { alert ("The test window is closed."); } else { alert ("The test window is opened."); } } else { alert ("The test window was never opened."); } } </script> </head> <body> You can open a test window and test its closed state with the following buttons: <br /> <button onclick="IsTestWindowClosed ();">Test the closed state</button> <br /> <button onclick="OpenTestWindow ();">Open the test window</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments