HTML and CSS Reference
To Enter the End Comment and End </script> Tags
Table 9-28 shows the code used to close the start <script> tag on line 6 and the start comment tag on line 7, as
entered in Figure 9-4 on page HTML 418.
Table 9-28 Closing the Script Section
Line 44 ends the comment, <!--Hide from old browsers, that was started on line 7. If the HTML comment
line is used and it is not closed properly, it will read the rest of the Web page document as part of the comment.
blank line 44.
If necessary, click
code shown in
Table 9-28 and do
not press the e n t e r
key after the last line
What happens if a
<script> section is
not closed properly?
If the HTML
comment line is used
and it is not closed properly,
the rest of the Web page document will be treated as a comment. When the user attempts to
view the Web page, nothing will appear after that comment line.
closing HTML comment line
and closing </script> tag
function to display
date Web page
insertion point; do
not press ENTER
key after closing
Why is the comment needed in <script> sections?
display from the point of the comment forward, thus giving the impression the Web page is
blank. If this occurs, always check to ensure the end comment tag was included.
Using event handlers to call user-defined functions.
Event handlers must be placed with the object (such as a button, drop-down menu, or HTML
tag) that controls the event. In this chapter, the events are load and change, so you use the
event handlers onLoad and onChange to call the user-defined functions. In this chapter, you
Place the onLoad event handler in the <body> tag.
Place the onChange event handler in the <select> tag that starts the drop-down menu.