English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The onmouseout attribute is used to get or set the event handler function for the current element's onmouseout event
Execute JavaScript when the mouse pointer moves out of the image:
<!DOCTYPE html> <html> <head> <title>Use of HTML onmouseout event attribute (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="pig.gif" alt="pig" width="32" height="32"> <p>When the user's mouse pointer is moved over the image, the bigImg() function will be triggered. This function enlarges the image.<br> When the mouse pointer leaves the image, the normalImg() function will be triggered. This function sets the height and width of the image to normal.</p> <script> function bigImg(x) { x.style.height = ""64px"; x.style.width = ""64px"; px"; function normalImg(x) { x.style.height = ""32px"; x.style.width = ""32px"; px"; </} </script> </body>html>/Test it out ‹
Browser CompatibilityIEFirefoxOperaChrome
Safari
Definition and Usage
The onmouseout attribute is triggered when the mouse pointer moves out of the element.Tip: The onmouseout attribute is usually used withused together
Note: The onmouseout attribute cannot be used on the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or <title>.
None.
<element onmouseout="script">
Value | Description |
---|---|
script | Specifies the script to be executed when the onmouseout event is triggered. |