DOM Window closed property and Status Bar
DOM Windows and Related Objects – Part 7
Forward: In this part of the series, we look at the window object closed property and the status bar.
By: Chrysanthus Date Published: 31 Jul 2012
Introduction
Note: If you cannot see the code or if you think anything is missing (broken link, image absent, etc.), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
The closed Property
The closed property of the window object returns a Boolean value indicating whether a window has been closed or not. Read and try the following code (click the button):
<!DOCTYPE HTML>
<html>
<head>
<title>Illustration</title>
<script type="text/ECMAScript">
function check()
{
alert(window.closed);
}
</script>
</head>
<body>
<p>text text text</p>
<button type="button" onclick="check()">Click</button>
</body>
</html>
To know whether the opener window is closed or not, you should type
window.opener.closed
The Status Bar
The status bar is the last bar at the bottom of the window. You can have the status bar displayed by clicking from the menu; something like, View>>Status Bar.
The window object status property sets or returns the text in the status bar at the bottom of the browser. Read and try the following code (click the button):
<!DOCTYPE HTML>
<html>
<head>
<title>Illustration</title>
<script type="text/ECMAScript">
function setStatus()
{
window.status = "I love you";
alert(window.status);
}
</script>
</head>
<body>
<p>text text text</p>
<button type="button" onclick="setStatus()">Click</button>
</body>
</html>
That is it for this part of the series. We stop here and continue in the next part.
Chrys
Related Links
Major in Website DesignWeb Development Course
HTML Course
CSS Course
ECMAScript Course
NEXT