HTML, XHTML, and CSS, Sixth Edition
Adding an "Automatic" Script
There are two kinds of scriptsthose that are executed without the visitor having to do anything and those that react to something the visitor has done. The first group might be called "automatic scripts" and are executed by the browser when the page is loaded. You can have as many automatic scripts as you like on a page. They will run in the order they appear. (The second group, "triggered scripts", is discussed on page 314.) To add an automatic script:
Figure 19.1. A script may appear anywhere in your (X)HTML document. However, where it appears determines when it will be executed.
Figure 19.2. This simple JavaScript script is output to the browser window itself. Other scripts send their results elsewhere.
|
Категории