One status bar for multiple windows

With JavaScript, you can display the status messages of links in one window in the status bar of another. Here's how.

By Brent Lee Metcalfe

It's possible to display the status messages of links in one window in the status bar of another. Omitting a subwindow's status bar conserves desktop real estate. Having all status prompts display in the primary browser's status bar creates a consistent user experience. Whatever you do, don't mix and match where the status prompts appear.

Notice that when you place your cursor over the x, y, and z graphics, the prompt message is displayed in the status bar of the primary browser window. Furthermore, the message strings and associated display functions reside in the HTML file that opened the new window:

var prompt = new Array('X','Y','Z');

function msgStat(prompt) {
  window.status = 'Status for faux link ' + prompt + ' !';

function eraser() {
  window.status = '';

onMouseOver and onMouseOut event handlers call the functions. For example, this is the code for faux link z:

<a href="javascript:void(0)" onMouseOver="opener.msgStat(opener.prompt[2]); return true" onMouseOut="opener.eraser(); return true"><img src="Images/z.jpg" border="0"></a>

The status prompt functions (msgStat() and eraser()) are accessed from the subwindow via its opener. In msgStat(), the link-specific variable (prompt) is passed as an argument to the function. Because variable prompt is an array of strings ("X", "Y", and "Z") you must include the [] operator to access the array elements. Note that in our example prompt[2] is also accessed via the opener.

Remember, if your site design severs the window object connection, status bar prompts that point to variables in the main browser HTML file won't work.

Brent Lee Metcalfe is a Web architecture consultant.

Editor's Picks

Free Newsletters, In your Inbox