<html>
<body>
<p>本例演示如何将 "onmouseover" 和 "onmouseout" 事件分配给 h1 元素。</p>
<h1 id="demo" onmouseover="mouseOver()" onmouseout="mouseOut()">请把鼠标悬停在我上面</h1>
<script>
function mouseOver() {
document.getElementById("demo").style.color = "red";
}
function mouseOut() {
document.getElementById("demo").style.color = "black";
}
</script>
</body>
</html>