IN THIS CHAPTER
Where to place scripts in HTML documents
What makes a script run
Viewing script errors
In this chapter's tutorial, you begin to see how scripts are embedded within HTML documents and what comprises a script statement. You also see how script statements can run when the document loads or in response to user action. Finally, you find out where script error information may be hiding.
Chapter 4 did not thoroughly cover what scripts look like or how you add them to an HTML document. That's where this lesson picks up the story.
To assist the browser in recognizing lines of code in an HTML document as belonging to a script, you surround lines of script code with a
<script>...</script> tag set. This is common usage in HTML, where start and end tags encapsulate content controlled by that tag, whether the tag set is for a form or a paragraph.
Depending on the browser, the
<script> tag has a variety of attributes you can set that govern the script. One attribute,