如何從 onmouseout 事件呼叫 JavaScript 函式?


onmouseout 在將滑鼠移出該元素時觸發。

示例

你可以嘗試執行以下示例來學習如何從 onmouseout 事件呼叫 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>

更新於: 2020 年 1 月 8 日

280 次瀏覽

開啟你的 職業生涯

完成課程並取得認證

開始學習
廣告
© . All rights reserved.