Define function in JavaScript
<html> <head> <script type="text/javascript"> function myfunction(){ alert("HELLO") } </script> </head> <body> <form> <input type="button" onclick="myfunction()" value="Call function"> </form> </body> </html>