JavaScript 参考手册
onmouseenter 事件
当鼠标指针移动到图像时执行 JavaScript
源代码:
点击运行 »
<img onmouseenter="bigImg(this)" onmouseleave="normalImg(this)" border="0" src="/examples/smiley.gif" alt="Smiley" width="32" height="32"> <p> bigImg() 函数在用户将鼠标指针移动到该图像时触发。</p> <p> normalImg() 函数在用户将鼠标指针移出图像时触发。</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>
运行结果:
点击运行 »