onmouseout event


onmouseout 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 onmouseout event occurs when the mouse pointer moves out of the specified object.

Syntax

HTML:

<elementonmouseout="SomeJavaScriptCode">

In JavaScript:

object.onmouseout=function(){SomeJavaScriptCode};

ParametersDescription
SomeJavaScriptCodeRequired. Specifies the JavaScript to be executed when this event occurs.


Browser support

QQ截图20161108165429.png

##All major browsers support the onmouseout event


HTML tags that support this event:

The onmouseout attribute can be used on HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.