onmouseoutonmouseout*
*Contents  *Index  *Topic Contents
*Previous Topic: onmousemove
*Next Topic: onmouseover

onmouseout

Description

Fires when the user moves the mouse pointer out of an element.

Remarks

When the user moves the mouse pointer into an element, one onmouseover event occurs, followed by one or more onmousemove events as the user moves the pointer within the element, and finally one onmouseout event when the user moves the pointer out of the element. This event will bubble. Events that bubble can be handled on any parent element of the object that fired the event.

Examples

The following JScript example sets the onmouseout event handler for an element having the identifier "para_1". The handler changes the color of the text in the element when the mouse pointer leaves the element.

<SCRIPT FOR=para_1 EVENT=onmouseout LANGUAGE="JScript">
var el = window.event.srcElement;
for ( ; el.id != "para_1"; el = el.parentElement);
el.style.color = "silver";
</SCRIPT>

The following JScript example sets the onmouseout event handler for an IMG element. The handler changes the image source file for the element when the mouse pointer leaves the element.

<IMG SRC="inactive.gif" onmouseover="flipImage('active.gif')" onmouseout="flipImage('inactive.gif')">
    .
    .
    .
<SCRIPT LANGUAGE="JScript">
function flipImage(url)
{
    if (window.event.srcElement.tagName == "IMG" ) {
        window.event.srcElement.src = url;
    }
}
</SCRIPT>

Applies To

A, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, H1, H2, H3, H4, H5, H6, HR, I, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, document


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.