JavaScript » eventhandler » onMouseOver

onMouseOver = myJavaScriptCode

Event handler for Layer, Link

The onMouseOver event handler is used to execute specified Javascript code whenever the user moves the mouse over an area or object from outside that area or object. If used with an Area object, that object must include the HREF attribute within the AREA tag. And if you want to set the status or defaultStatus properties using the onMouseOver event handler, you must return true within the event handler. OnMouseOver uses the following properties of the Event object:
type - indicates the type of event.
target - indicates the target object to which the event was sent.
layerX, layerY, pageX, pageY, screenX, screenY
   indicate the cursor location at the time of the MouseOver event.


<IMG name="myImage" src="/images/myPic.jpg" onMouseOver="changeImage()">

This example creates an Image object. When the user moves the mouse over that image from outside of it, the onMouseOver event handler changes the picture displayed by calling the 'changeImage' function which (not listed) alters the src property of the Image object.

See Also: