JavaScript-Referenzhandbuch
/ onmousemove 事件
onmousemove 事件
onmousemove 事件
實(shí)例
<!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>函數(shù) bigImg() 在鼠標(biāo)指針移動到笑臉圖片是觸發(fā)。</p> <p>函數(shù) normalImg() 在鼠標(biāo)指針移出笑臉圖片是觸發(fā)。</p> </body> </html>
運(yùn)行實(shí)例 ?
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例
定義和用法
onmousemove 事件會在鼠標(biāo)指針移出指定的對象時發(fā)生。
語法
In HTML:
<elementonmousemove="SomeJavaScriptCode">
In JavaScript:
object.onmousemove=function(){SomeJavaScriptCode};
參數(shù) | 描述 |
---|---|
SomeJavaScriptCode | 必需。規(guī)定該事件發(fā)生時執(zhí)行的 JavaScript。 |
瀏覽器支持
所有主要瀏覽器都支持 onmousemove 事件
支持該事件的 HTML 標(biāo)簽:
onmousemove 屬性可用于使用 HTML 元素,除了: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.