JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Link.onmouseover() Handler

Name

Link.onmouseover() Handler---invoked when the mouse goes over a link

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

<A onMouseOver="handler-statements">    a definition of the handler
<AREA onMouseOver="handler-statements"> another definition; Navigator 3.0 only
link.onmouseover  a reference to the handler
link.onmouseover();   an explicit invocation of the handler

Description

onmouseover() is an event-handler function invoked when the user moves the mouse over a hypertext link. This event handler is defined by the onMouseOver attribute of the HTML <A> or <AREA> tag that defines the hypertext link. The value of this attribute may be any number of JavaScript statements, separated by semicolons. These statements will be executed when the user moves the mouse over the link.

By default, the browser displays the URL that a hypertext link refers to in the status line whenever the mouse goes over the link. The onmouseover() event handler is invoked before the URL is displayed. If the handler returns true, then the browser will not display the URL. Thus, an event-handler function that returns true can display a custom message in the status line by setting the Window.status property to any desired value itself.

Note that while this event handler returns true to tell the browser not to perform its default action (displaying the URL of a link), the onclick() event handler of the Link object must return false to tell the browser not to take its default action (following the link). This incompatibility exists for historical reasons. The standard for Form and form element event handlers is to return false to prevent the browser from performing a default action.

See Also

"Link", "Link.onmouseout()"


Previous Home Next
Link.onmouseout() Book Index Link.pathname

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell