JS

JavaScript Demos:
Simple Status Message from Mouse RollOver.

jim.cerny@unh.edu  13-AUG-1998


Pass the mouse over this word.


Discussion.

This is a simple example of an event triggered by a mouse passing over an object onscreen. This is variously referred to as a "mouseover" or "rollover". This example follows Gesing and Schneider, p. 110. Please note the following:

  • The "onmouseover" is an event handler that can be used to trigger some action when placed either in a hyperlink or image map. This is a very simple case that just causes text to be displayed in the window status bar (bottom of browser screen) under two different event conditions:
    (1) When the page first loads - BODY tag.
    (2) When the link is activated - A tag.
    This does not include a companion "onmouseout" handler to remove the message - the last message remains until the page is refreshed. The statement "return true" is needed on the A event to ensure the status line is updated.

  • There is no specific script invoked and a non-JavaScript capable browser should just ignore the "onmouseover" as an unrecognized attribute on the BODY and A tags.

  • In this example we aren't actually linking to anything, but it could link to a real file.