Window.status (Property)

A property containing the text displayed in the status bar.


JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:String primitive
JavaScript syntax:-myWindow.status
-myWindow.status = aString
-status = aString
Argument list:aStringA string to display in the status bar

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"; = "ABCD";

top.defaultStatus = "ABCD"; = "ABCD";


Example code:

   <BODY onMouseMove="mouseOmeter();">
   // An example mouse coordinate display for MSIE
   function mouseOmeter()
      window.status = window.event.x + "," + window.event.y;
      return true;

See also:Frame object, onMouseOut, onMouseOver, Status line, Window object, Window.defaultStatus