The mouseover event fires when the user moves the mouse onto an element. The mouseout event fires when the user moves the mouse out of an element. Unfortunately these events bubble up.
In general you want to use mouseenter and mouseleave instead of mouseover and mouseout. Unfortunately the other browsers still haven’t copied this brilliant Microsoft invention. Come on, guys!
| Method or property | IE 5.5 | IE 6 | IE 7 | IE8b1 | FF 2 | FF 3 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Opera 9.26 | Opera 9.51 | Konqueror 3.5.7 | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
On the window
|
No | Yes | Yes | Alter |
Minimal | Yes | ||||||||
|
Are these events available on the window?
|
||||||||||||||
|
On the document
|
Yes | Yes | Yes | Alter |
Yes | Yes | ||||||||
|
Are these events available on the document? |
||||||||||||||
|
On any element
|
Yes | Almost | Yes | Buggy | Yes | Yes | Alter |
Incom |
Yes | |||||
|
Are these events available on any element, including form fields and links?
|
||||||||||||||
| Method or property | IE 5.5 | IE 6 | IE 7 | IE8b1 | FF 2 | FF 3 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Opera 9.26 | Opera 9.51 | Konqueror 3.5.7 | ||
|
Event bubbling
|
Yes | Yes | Yes | Almost | Yes | |||||||||
|
The events should bubble up. (In fact they shouldn’t, because the bubbling effect is exactly what makes these events so hard to use, but they do and according to timeless tradition they should.)
|
||||||||||||||
|
Cancel bubble
|
Yes | Yes | Yes | Yes | Yes | |||||||||
On the iPhone these events fire when the user focus moves from one element to another. When an element gains the focus it fires mouseover, when it loses the focus it fires mouseout.
| Method or property | IE 5.5 | IE 6 | IE 7 | IE8b1 | FF 2 | FF 3 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Opera 9.26 | Opera 9.51 | Konqueror 3.5.7 | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
mouseenter
When the mouse enters an element, but it doesn’t bubble. MUCH more useful than mouseover. Come on, Mozilla. Come on, Safari. Come on, Opera. Come on, Konqueror. |
Yes | No | No | No | No | |||||||||
|
The other browsers should implement these events as soon as possible. (Yes, I know I’m shouting, but I’ve been saying this since 2003 and nobody has ever paid my message the least attention.) Mouseover and mouseout also fire when the user mouses over or out of a child element of the element
you registered the events on. Mouseenter and mouseleave don’t. Thus, they are the true equivalent of CSS Once these events are supported by all browsers, creating dropdown menus will become a walk in the park. It’s Firefox’s, Safari’s and Opera’s fault that we still have to waste hours and hours on carefully distinguishing between important and unimportant mouseover and mouseout events. If we just had mouseenter and mouseleave, all our problems would be solved. |
||||||||||||||
|
mouseleave
When the mouse leaves an element, but it doesn’t bubble. MUCH more useful than mouseout. |
Yes | No | No | No | No | |||||||||
|
See mouseenter remarks. |
||||||||||||||
| Method or property | IE 5.5 | IE 6 | IE 7 | IE8b1 | FF 2 | FF 3 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Opera 9.26 | Opera 9.51 | Konqueror 3.5.7 | ||