如何从 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-01-08

280 次浏览

开启您的 职业生涯

完成教程认证

开始
广告
© . All rights reserved.