How to call a JavaScript function from an onmouseover event?

JavascriptWeb DevelopmentFront End Technology

The onmouseover event triggers when you bring your mouse over any element.

Example

You can try to run the following example to learn how to call a JavaScript function from onmouseover event

Live Demo

<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>
raja
Published on 30-Jan-2018 15:05:20
Advertisements