如何從 onmouseover 事件呼叫 JavaScript 函式?
當你將滑鼠移動到任何元素上時,onmouseover 事件將觸發。
示例
你可以嘗試執行以下示例來學習如何從 onmouseover 事件呼叫 JavaScript 函式
<html> <head> <script> <!-- function over() { document.write ("Mouse Over"); } function out() { document.write ("Mouse Out"); } //--> </script> </head> <body> <p>Bring your mouse inside the division to see the result:</p> <div onmouseover="over()" onmouseout="out()"> <h2> This is inside the division </h2> </div> </body> </html>
廣告