The JavaScript Diaries: Part 7/Page 3
[previous] [next]
The JavaScript Diaries: Part 7
defaultStatus
The status bar is located at the bottom of the browser. Usually, it displays the URL of a link on the Web page when the mouse hovers over it. The defaultStatus
property sets a message to display in the status bar when nothing else is displayed, such as a welcome message or instructions to the visitor. It can be set when the page is initially loaded or when some other event happens. To set it when the page is loaded, you can use the following script in the <body>
tag:
<body onLoad="window.defaultStatus='Welcome to my Web page!';">
Be aware, however, that many users prefer to see the URL in the status bar rather than a message.
frames
This property contains an array of all the frames in the current window. We'll look at this in more detail later when we learn about arrays.
name
This property contains the name of the window. The name of the window should not be confused with the title of the page, which is located within the <title></title>
tags. The name
is used by the browser to reference the window.
You can use the name
property to retrieve the name of the current
window or to assign a name to the window. It's useful when using frames and
popup windows.
It's important to note that the main window in the browser does not have a name. Using the name
property without first declaring a name for the window will return an empty string.
There are several techniques used in assigning a name to a window. One method would be to place the following script in the <head>
section:
window.name="The Main Window";
Then, if you want to display the name of the window on the page, place this script in the <body>
section:
document.write("The name of this window is " + window.name);
The process used here is pretty straightforward. Before the page loaded, we
used the name
property of the window
object to assign
a name to the current window. Then, once the page was loaded, we wrote the name
of the window to the Web page.
opener
This property is used in popup windows to refer to the window that originally opened it. If the window was opened by the user, it will return a value of null
as there is no valid window (not valid, meaning that it was not opened by a script). See also the closed
property.
[previous] [next]
Created: July 22, 2005
URL: