HTML and CSS Reference
When scripts are long or need to be shared by other pages, they are usually placed in
It enables you to apply one set of functions to every page of the site, so that when you
need to make a change, you can do it in one document rather than going through each
Script code and is saved as a .js file. The .js file is linked to the Web page by including it
between the <head> tags of the HTML document and within its own <script> tags. The
file. The external file name includes the full URL if the script is on another server, direc-
tory path or just the script name if in the local directory. You can include more than one
.js script in a file.
The following examples, although very small, give you the idea of how external files are
// The external file called "welcome.js"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<title>External .js File</title>
We are working with an external file.<br />
<input type="button" onClick="welcome()" value="Welcome Me!" />