onmousemove event
onmousemove Event
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> function bigImg(x){ x.style.height="64px"; x.style.width="64px"; } function normalImg(x){ x.style.height="32px"; x.style.width="32px"; } </script> </head> <body> <img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="smiley.gif" alt="Smiley" width="32" height="32"> <p>函数 bigImg() 在鼠标指针移动到笑脸图片是触发。</p> <p>函数 normalImg() 在鼠标指针移出笑脸图片是触发。</p> </body> </html>
Run Instance»
Click "Run instance" button to view the online instance
Definition and usage
The onmousemove event occurs when the mouse pointer moves out of the specified object.
Syntax
In HTML:
<elementonmousemove="SomeJavaScriptCode">
In JavaScript:
object.onmousemove=function(){SomeJavaScriptCode};
Parameters | Description |
---|---|
SomeJavaScriptCode | Required. Specifies the JavaScript to be executed when this event occurs. |
Browser Support
##All major browsers support the onmousemove event
HTML tags that support this event: The onmousemove attribute can be used with HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.