好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html在鼠标指针移动到元素上时触发的函数onmousemove

所有主流浏览器都支持 onmousemove 属性。

定义和用法

onmousemove 属性在鼠标指针移动到元素上时触发。

注释:onmousemove 属性不适用以下元素:<base>、<bdo>、<br>、<head>、<html>、<iframe>、<meta>、<param>、<script>、<style> 或 <title>。

HTML 4.01 与 HTML5 之间的差异

无。

语法

<element onmousemove="script"> 

属性值

值 描述 script onmousemove 发生时运行的脚本。

实例

当鼠标指针移动到图像上时执行一段 JavaScript(使图像放大):

<!DOCTYPE html>  
<html>  
<head>  
<script>  
function bigImg(x)  
{  
x.style.height="180px";  
x.style.width="180px";  
}  
function normalImg(x)  
{  
x.style.height="128px";  
x.style.width="128px";  
}  
</script>  
</head>  
<body>  
<img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="/i/eg_smile.gif" alt="Smiley" >  
<p>函数 bigImg() 在鼠标指针移动到图像上时触发。此函数放大图像。</p>  
<p>函数 normalImg() 在鼠标指针移出图像时触发。此函数把图像的高度和宽度重置为正常尺寸。</p>  
  
</body>  
</html> 

以上就是html在鼠标指针移动到元素上时触发的函数onmousemove的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于html在鼠标指针移动到元素上时触发的函数onmousemove的详细内容...

  阅读:51次