15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2 ✦ Window and Frame Objects (Chapter 16)<br />

As a safeguard against platform-specific anomalies that affect the behavior of<br />

onMouseOver event handlers and the window.status property, you should also<br />

include an onMouseOut event handler for links and client-side image map area<br />

objects. Such onMouseOut event handlers should set the status property to an<br />

empty string. This setting ensures that the statusbar message returns to the<br />

defaultStatus setting when the pointer rolls away from these objects. If you want<br />

to write a generalizable function that handles all window status changes, you can<br />

do so, but word the onMouseOver attribute carefully so that the event handler evaluates<br />

to return true. Listing 16-18 shows such an alternative.<br />

Listing 16-18: Handling Status Message Changes<br />

<br />

<br />

Generalizable window.status Property<br />

<br />

function showStatus(msg) {<br />

window.status = msg<br />

return true<br />

}<br />

<br />

<br />

<br />

Home<br />

Netscape<br />

<br />

<br />

Notice how the event handlers return the results of the showStatus() method<br />

to the event handler, allowing the entire handler to evaluate to return true.<br />

One final example of setting the statusbar (shown in Listing 16-19) also demonstrates<br />

how to create a simple scrolling banner in the statusbar.<br />

Listing 16-19: Creating a Scrolling Banner<br />

<br />

<br />

Message Scroller<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!