We can attach Java script with HTML page by using two simple ways.
Way 1:
Step 1 -- First create a new java script source file, where we type all of our java code and save it with .js extension. You can use any file name as for example: myjavascript.js, javascript.js, script.js etc. But don't forget to use .js extension.
Step 2: Type this link after title tag in main HTML page and start typing code-->
Way 2:
Just use script tags in the last of body tag of HTML page and start typing code.This is also a nice way to access Java script.