Pass argument to a simple javascript function - Javascript Function

Javascript examples for Function:Function Argument

Description

Pass argument to a simple javascript function

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/* w ww .  ja v a 2  s.co m*/

window.restart = function(msg) {
   console.log(msg);
}

    }

      </script> 
   </head> 
   <body> 
      <a href="#" onclick="restart(&quot;Hello&quot;);">Test</a>  
   </body>
</html>

Related Tutorials