What is the difference between the onFocus and onMouseEnter event?
+8
A:
onFocus, when applied to form elements, is triggered when the field is given focus by either tabbing to the field or clicking on it so you can enter a value. Most HTML elements are not given focus through onMouseEnter in any case, so the two events are completely different.
Salty
2009-07-17 20:36:42
Also, only IE supports the mouseenter event natively. All browsers support the focus event.
Crescent Fresh
2009-07-17 20:48:42
+1
A:
You get the onMouseEnter when the mouse just hovers over the object. You can also get focus with the keyboard by tabbing to the control or programatically.
heavyd
2009-07-17 20:37:31
+2
A:
The onfocus
event fires when the user clicks on an element, usually <input>
or <textarea>
elements, and the mousover
event fires when the pointer mouses over any element on the page. The mouseenter
event, however, is a non-standard event used by IE and implemented by some javascript libraries.
tj111
2009-07-17 20:39:00