onmouseover event
onmouseover 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 onmouseover="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 onmouseover event occurs when the mouse pointer moves over the specified element.
Syntax
HTML:
<elementonmouseover="SomeJavaScriptCode">
JavaScript:
object.onmouseover=function(){SomeJavaScriptCode};
Parameters | Description |
---|---|
SomeJavaScriptCode | Required. Specifies the JavaScript to be executed when this event occurs. |
Browser support
The onmouseover event All major browsers support
HTML tags that support this event:
The onmouseover attribute can be used on all HTML elements except: <base>, <bdo> , <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.