Normally we use java script syntax in the below written manner.
Let us create a file which will call a function which is defined outside of the HTML.
<title> Testing External Button</title>
<input type=”button” name=”button2″ value=”Click me i am 1″ onClick=’test()’ />
<input type=”button” name=”button1″ value=”Click me” />
Here this function will call test which is defined outside of the HTML file.
alert(“I am here”);
This is saved in test.js . I have placed this .js file in the same folder where this HTML file is present.
Done!!!…Now you can call whatever function you want in your flow.
- Hide code from User.
- Reduce load from HTML file
- Easy to use
- Reusability ..You can reuse across different pages.
Image Credit: http://erenbasaran.wordpress.com