Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

onmouseenter event

onmouseenter event

Event Object Reference Event Object

Example

Execute JavaScript when the mouse pointer moves over the image:

Smiley

Try it »

In the more examples below, click "Try it" to see more demonstrations.


Definition and Usage

The onmouseenter event is triggered when the mouse pointer moves onto an element.

Tip: This event is usually used together with onmouseleave the event, which is triggered when the mouse pointer moves out of the element.

Tip: The onmouseenter event is similar to onmouseover The onmouseenter event is similar to the event. The only difference is that the onmouseenter event does not support bubbling.


Browser support

The numbers in the table indicate the version number of the first browser to support the event.

Events
onmouseenter 30.0 5.5 Yes 6.1 11.5

Syntax

In HTML:

<

element

onmouseenter="

myScript

">

Try it

In JavaScript:

object

.onmouseenter=function(){

myScript

};

Try it

In JavaScript, use the addEventListener() method:

object

.addEventListener("mouseenter",

myScript

);

Try it

Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.


Technical Details

Does it support bubbling: No
Is it cancelable: No
Event type: MouseEvent
Supported HTML tags: All HTML elements, except: , ,
, , ,