If you use a script in several different Web pages, you'll save time and avoid typos by creating an external script (in text-only format) and then calling the script from each page where it is used. To call an external automatic script:
Figure 19.3. Here I've created an independent text file with the same script as in Figure 19.1. I can reference this external script from inside any (X)HTML file.
Figure 19.4. The src attribute not only references the script, it also automatically hides it from browsers that don't recognize the script tag.
Figure 19.5. The effect in the browser is the same as if it had been an internal script.
Tips
|