Latest web development tutorials

onmouseenter event

Event Object Reference Event objects

Examples

JavaScript is executed when the mouse pointer is moved to the image:

<Img onmouseenter = "bigImg (this)" src = "smiley.gif" alt = "Smiley">

try it"

In the following examples more point "try" to see more demonstrations.


Definition and Usage

Onmouseenter trigger event to move the mouse pointer over the element.

Note: This event is usually associated with onmouseleave used in conjunction with the event, triggered when the mouse pointer moves out of the element.

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


Browser Support

Figures in the table represent the first browser to support this version of events.

event
onmouseenter 30.0 5.5 Yes 6.1 11.5


grammar

In HTML:

<Elementonmouseenter = "myScript"> try

In JavaScript:

object .onmouseenter = function () {myScript }; try

JavaScript, use the addEventListener () method:

object .addEventListener ( "mouseenter", myScript ); try

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


technical details

Whether to support the bubble: No
It can be canceled: No
Event Type: MouseEvent
Supported HTML tags: All HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>


Examples

More examples

Examples

This example demonstrates the different onmousemove, onmouseenter and mouseover event:

<Div onmousemove = "myMoveFunction ()">
<P id = "demo"> I will demonstrate onmousemove! </ P>
</ Div>

<Div onmouseenter = "myEnterFunction ()">
<P id = "demo2"> I will demonstrate onmouseenter! </ P>
</ Div>

<Div onmouseover = "myOverFunction ()">
<P id = "demo3"> I will demonstrate onmouseover! </ P>
</ Div>

try it"


Event Object Reference Event objects