onmouseover:鼠标悬停在元素上的时候触发
onmouseout:鼠标移开的时候触发
eg:鼠标悬停时背景为红色,鼠标移开时背景为绿色
代码:
<body><p id="p"> hello world</p><script>var p = document.getElementById("p");p.onmouseover =function(){this.style.background ="red";}p.onmouseout =function(){this.style.background ="green";}</script></body>

