Putting JavaScript into Your HTML Pages

This section contains several scripts written in JavaScript that illustrate some of the things that you can do using JavaScript that cannot be done with HTML alone. All these scripts are simple, but at this point in the book, they are not explained beyond the most general terms. They serve to illustrate where to place JavaScript code and the difference between immediate and deferred working of the script. An immediate script executes as soon as it loads, and a deferred script waits until the user does something to make the script launch.

Most JavaScript is written in a tag container named script. The generic format looks like the following:

<script language="JavaScript"> 
script goes here 
</script> 

Get JavaScript Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.