onmouseout屬性用來獲取或設(shè)置當(dāng)前元素的mouseout事件的事件處理函數(shù)
將鼠標(biāo)指針移出圖像時(shí)執(zhí)行JavaScript:
<!DOCTYPE html>
<html>
<head>
<title>HTML onmouseout 事件屬性的使用(菜鳥教程 cainiaoplus.com)</title>
</head>
<body>
<img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="pig.gif" alt="pig" width="32" height="32">
<p>當(dāng)用戶鼠標(biāo)指針移到圖像上方時(shí),將觸發(fā)bigImg()函數(shù)。此功能放大圖像。<br>
當(dāng)鼠標(biāo)指針移出圖像時(shí),將觸發(fā)normalImg()函數(shù)。該功能將圖像的高度和寬度設(shè)置為正常。</p>
<script>
function bigImg(x) {
x.style.height = "64px";
x.style.width = "64px";
}
function normalImg(x) {
x.style.height = "32px";
x.style.width = "32px";
}
</script>
</body>
</html>測(cè)試看看 ?/?IEFirefoxOperaChromeSafari
所有主流瀏覽器都支持 onmouseout 事件屬性
當(dāng)鼠標(biāo)指針移出元素時(shí),會(huì)觸發(fā)onmouseout屬性。
提示: onmouseout屬性通常與onmouseover屬性一起使用
注意: onmouseout 屬性不能使用于以下元素: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, 或 <title>。
沒有。
<element onmouseout="script">
| 值 | 描述 |
|---|---|
| script | 規(guī)定該onmouseout事件觸發(fā)時(shí)執(zhí)行的腳本。 |