Definition and usage
Definition and usage
The onmousemove event occurs when the mouse pointer is moved.
Onmousemove event triggered when the mouse moves
Syntax
Syntax
Parameter Parameters |
Description Note |
Sometriccriptcode Code to be executed |
Required. specifies a JavaScript to be executed when the event occurs. Required. Code to be executed when an event is triggered |
Supported by the following HTML tags:
Supported HTML tags:
| <A>, <address>, <area>, <B>, <BDO>, <big>, <BLOCKQUOTE>, <body>, <button>, <caption>, <cite>, <code>, <DD>, <dfn>, <div>, <DL>, <DT>, <em>, <fieldset>, <form>, |
Supported by the following JavaScript objects:
Supported JavaScript objects:
Onmousemove is, by default, not an event of any object, because mouse movement happens very frequently. Onmousemove is not an event of any object by default, because the mouse moves frequently. |
Tips and notes
Note:
Note:Each time a user moves the mouse one pixel, A mousemove event occurs. It takes system resources to process all mousemove events. Use this event carefully!
Note:A mousemove event is triggered when the user moves one pixel. This will consume a lot of system resources. Please use it with caution.
Example
Instance
In the following example we will display an Alert box when the user moves the mouse pointer over the image:
In the following example, a message box is displayed when you move your mouse over the image:
Onmousemove = "alert ('w3pop! ') "/> |
The output of the code above will be:
Output result:
Try-it-yourself demos
Interactive demonstration
Onmousemove
How to Use onmousemove.
How to Apply onmousemove
Reproduced http://www.w3pop.com/tech/school/jsref/jsref_onmousemove.asp