This property should be used to set a transient value for the status bar when providing some rollover management.
This is ideal for use in event handlers or fragments of code being executed with a deferred task. Normally setting this from a script would display the status text only momentarily until the user moved the mouse or the document finished loading.
When the status text is erased, the defaultStatus value of the window will usually be the text that overwrites it, unless some other text is called in the meantime. It really depends on what event handlers are invoked as the mouse moves.
In Netscape Navigator, setting the status value in a submit button onClick handler instantly updates the value displayed in the status bar. However as soon as you roll off the button, the defaultStatus value is displayed instead and the transient status value is lost. Rolling back onto the submit button won't display it again because it was set by the onClick handler.
In MSIE, the behavior of the status and defaultStatus properties is so nearly identical as to be hard to distinguish one from the other.
The status message box belongs to the top level window. This means that it behaves with some slight differences if there are multiple frames and the status and defaultStatus properties are set from inside them. This is also prone to differences between browsers and it is recommended that you experiment somewhat to achieve exactly the desired behavior you want to make sure it is consistent across the two main browsers.
Setting this value in the onMouseOver event handler requires that you signal the browser to not immediately update the status bar value when the handler exits. To do this, return a Boolean true value to inhibit any further browser activity. Likewise, you'll also need to do this in a onMouseMove handler. The example illustrates a simple "mouse'O'meter" to display the current mouse coordinates as the mouse moves. This only works in MSIE, however, and then only while the window has focus. This might be useful when working out where to position objects with dynamic HTML.
Frame-set contents that run script to set status bar values might operate better if you explicitly tell them to set the status property that belongs to the top level window. That is accessible via the top property, thus:
top.status = "ABCD";
window.top.status = "ABCD";
top.defaultStatus = "ABCD";
window.top.defaultStatus = "ABCD";
Beware that some browsers do not correctly restore the status bar to its default condition after the rollover is deactivated by moving the mouse pointer somewhere else. This is the case for Netscape 2 and 3 on the Windows platform. Adding an onMouseOut handler may provide a satisfactory work around.
<BODY onMouseMove="mouseOmeter();"> ... // An example mouse coordinate display for MSIE function mouseOmeter() { window.status = window.event.x + "," + window.event.y; return true; }
Prev | Home | Next |
Window.sidebar | Up | Window.statusbar |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |