Linking, Linking, Linking!
Linking your JavaScript to a Web page involves writing your JavaScript in a separate file and linking the Web page and this file together. Simple in concept and simple in practice!
Some conventions must be followed—well, one in fact. The file that will contain your JavaScript should have the file extension .JS. Those of you who like investigating how things work and why things don't will find that other file extensions will work. However, .JS is the recommended one to use!
WARNING
If you find that any of your linked scripts don't work, before you start to rip apart the code you've written looking for errors, check that you are referring to the correct file. A common error here is to save the file containing the JavaScript ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access