
|
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 by Infinite Software Solutions, Inc.
Trademark Information |