Matukio ya onmouseenter
Mifano na Matumizi
matukio kwa kushikilia kikaa cha koma kwenye elementi.
Tip:This event is usually used with Matukio ya onmouseleaveused together, this event occurs when the mouse pointer moves out of the element.
Tip: The onmouseenter event is similar to Matukio ya onmouseover. The only difference is that the onmouseenter event does not bubble (does not propagate up the document hierarchy). See more examples at the bottom of the page.
Example
Example 1
Execute JavaScript when the mouse pointer is moved over the image:
<img onmouseenter="bigImg(this)" src="smiley.gif" alt="Smiley">
Example 2
This example demonstrates the difference between onmousemove, onmouseenter, and mouseover events:
<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>
Syntax
In HTML:
<element onmouseenter="myScript">
In JavaScript:
object.onmouseenter = function(){myScript};
In JavaScript, use the addEventListener() method:
object.addEventListener("mouseenter", myScript);
Note:Internet Explorer 8 and earlier versions do not support addEventListener() method.
Technical details
Bubble: | Not supported |
---|---|
Cancellable: | Not supported |
Types of events: | MouseEvent |
HTML tags supported: | All HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style> and <title> |
DOM Version: | Matukio ya Level 2 |
Mfanya mtandao
Inafaa kumekua namba za kina ya tovuti iliyotumika kwa kusakinisha matukio hii.
Matukio | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
onmouseenter | 30.0 | 5.5 | Mwongozo | 6.1 | 11.5 |