Hover link call function only once - Javascript Function

Javascript examples for Function:Function Call

Description

Hover link call function only once

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Hover Once</title> 
   </head> 
   <body> 
      <a href="#" onmouseover="onHover(this)">Link 1</a> 
      <a href="#" onmouseover="onHover(this)">Link 2</a> 
      <a href="#" onmouseover="onHover(this)">Link 3</a> 
      <script>
            function onHover(element) {
                if(element.alreadyHovered == null) {
                    console.log("call dothis()");
                    element.alreadyHovered = true;
                }/*from w  w  w.j  a v a 2  s  . c om*/
            }
            
      </script>  
   </body>
</html>

Related Tutorials