当鼠标指针移出 HTML 中的元素时执行某个脚本?
当鼠标指针移出某个元素时,onmouseout 属性被触发。你可以尝试以下代码来实现 onmouseout 属性 −
示例
<!DOCTYPE html> <html> <body> <h3 id = "myid" onmouseout = "mouseOut()"> This is demo heading. </h3> <p>Click above and then release.</p> <script> function mouseOut() { document.getElementById("myid").style.color = "red"; } </script> </body> </html>
广告