[This documentation is preliminary and is subject to change.]
Fires when the user moves the mouse pointer into the object.
![]() |
Syntax
| HTML Attribute | <element onmouseover = "handler(event)"> |
|---|---|
| Event Property | object.onmouseover = handler; |
| attachEvent Method | object.attachEvent("onmouseover", handler) |
| addEventListener Method | object.addEventListener("mouseover", handler, useCapture) |
Standards information
- HTML 4.01 Specification, Section 18.2.3
Event information
| Synchronous | No |
|---|---|
| Bubbles | No |
| Cancelable | No |
Event handler parameters
- pEvtObj [in]
-
Type: IHTMLEventObj
Remarks
The event occurs when the user moves the mouse pointer into the object, and it does not repeat unless the user moves the mouse pointer out of the object and then back into it.
Initiates any action associated with this event.
To invoke this event, do one of the following:
- Move the mouse pointer into an object.
The pEvtObj parameter is required for the following interfaces:
- HTMLAnchorEvents2
- HTMLAreaEvents2
- HTMLButtonElementEvents2
- HTMLControlElementEvents2
- HTMLDocumentEvents2
- HTMLElementEvents2
- HTMLFormElementEvents2
- HTMLImgEvents2
- HTMLFrameSiteEvents2
- HTMLInputFileElementEvents2
- HTMLInputImageEvents2
- HTMLInputTextElementEvents2
- HTMLLabelEvents2
- HTMLLinkElementEvents2
- HTMLMapEvents2
- HTMLMarqueeElementEvents2
- HTMLObjectElementEvents2
- HTMLOptionButtonElementEvents2
- HTMLScriptEvents2
- HTMLSelectElementEvents2
- HTMLStyleElementEvents2
- HTMLTableEvents2
- HTMLTextContainerEvents2
- HTMLWindowEvents2
- HTMLWindowEvents4
Examples
This example uses the onmouseover event to apply a new style to an object.
<p
onmouseover="this.style.color='red'"
onmouseout="this.style.color='black'">
Move the mouse pointer over this text to change its color. Move the pointer off the text
to change the color back.
</p>
This example shows how to change the value of a text area in response to mouse events.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onmouseoverEX.htm
<p>Move the mouse pointer into the text area to fire the onmouseover event. Move
it out to clear the text.
<textarea name="txtMouseTrack"
onmouseover="this.value='onmouseover fired'"
onmouseout="this.value=''">
</textarea></p>
See also
- a
- abbr
- acronym
- address
- applet
- area
- audio
- b
- bdo
- big
- blockQuote
- body
- button
- canvas
- caption
- center
- cite
- code
- custom
- dd
- del
- dfn
- dir
- div
- dl
- document
- dt
- em
- embed
- fieldSet
- font
- form
- hn
- hr
- i
- img
- input type=button
- input type=checkbox
- input type=file
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- kbd
- label
- legend
- li
- listing
- map
- marquee
- menu
- noBR
- object
- ol
- p
- plainText
- pre
- q
- rt
- ruby
- s
- samp
- select
- small
- source
- span
- strike
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- tr
- tt
- u
- ul
- var
- video
- window
- xmp
- SVGSVGElement
- Reference
- onmousewheel
- onmousedown
- onmousemove
- onmouseout
- onmouseup
Build date: 3/14/2012
N.B. Inner-element events can fire outside and expose outer properties to the inner event-handler.
e.g. (Contenteditable; Doubly-justified to put the scrollbar on the left)
<DL style="writing-mode:rl-tb
<DIV contentEditable style="writing-mode:lr-tb
<DT onmouseover="event.srcElement.runtimeStyle.cssText='color:red'
--sweeping the mouse from the middle of DT-text, left to outside, fires on the BODY and changes body color.
DISCOVERY: IF(event.srcElement != this), fires after the mouse-sweep crosses left outside the DT to the BODY.
N.B. #2. DOES NOT CANCEL! (cancelBubble prevents the BODY-onmouse-event from firing on the DT, but does-not prevent the DT-onmouse-event from firing on the BODY as herein-described.)
1. This event does not fire if/when the scroll moves under the pointer...
2. But does fire if/when a popup event occurs, e.g. popup appears-or-disappears, element.title disappears, autc.
3. This event also fires outside the element when the mouse sweeps outside. [SEE CAUTION; 2011-01-21]
http://blog.rednael.com/2009/09/01/TrappingMouseEventsOnTransparentInputElementsOrTextareasInIE.aspx
It describes an issue when trying to trap mouse events on transparent Input elements (type=text) and Textarea elements.
