Name

HTMLElement.onmousemove: event handler invoked when the mouse moves within an element — DOM Level 0

Synopsis

Function onmousemove

Description

The onmousemove property of an HTMLElement object specifies an event-handler function that is invoked when the user moves the mouse pointer within the element.

If you define an onmousemove event handler, mouse motion events are generated and reported in huge quantities when the mouse is moved within element. Keep this in mind when writing the function to be invoked by the event handler. If you are interested in tracking mouse drags, register a handler of this type in response to a mousedown event and then deregister it when the mouseup event arrives.

See Also

Element.addEventListener( ), Event, MouseEvent; Chapter 17

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.