代码示例:(标识:eg_js_events_onmouseover)
<!DOCTYPE html>
<html>
<head>
<script>
function bigImg(x) {
  x.style.height = "150px";
  x.style.width = "150px";
}

function normalImg(x) {
  x.style.height = "50px";
  x.style.width = "50px";
}
</script>
</head>
<body>

<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" 
src="/static/demo/images/eg_smile.gif" alt="Smiley" width="128" height="128">

<p>当用户将鼠标指针移到图像上时,会触发 bigImg() 函数。</p>

<p>当鼠标指针移出图像时,会触发 normalImg() 函数。</p>

</body>
</html>
运行结果: