HTML and CSS Reference
In-Depth Information
To Complete a JavaScript Section
The following steps enter the JavaScript code to complete the <script> section.
1
If necessary, click line 19, and position the insertion point to line up under the <script>
tag on line 6.
2
Type //--> to close the comment to hide the JavaScript and then press the e n t e r key.
3
Type </script> to close the <script> section, but do not press the e n t e r key
(Figure 10-11).
Can I use one hyphen and the greater than sign to end the comment?
No, it must be two hyphens and the greater than sign to close the comment.
end of <script> section
do not press
the e n t e r key
Figure 10-11
Adding an Onload Event Handler
The last step in adding a scrolling message to a Web page is to add an event handler
to start the scrolling message when the Web page loads. As discussed in Chapter 9, an
event is an action, such as a mouse click or a window loading. An event handler is a
way to associate that action with a function. The event handler that starts the scrolling
message is the onLoad event handler and is placed in the <body> tag.
The JavaScript standard uses both uppercase and lowercase in spelling event
handlers, as shown in Table 10-8 on the next page. To be HTML5 compliant and to pass
HTML5 validation, this text follows the HTML5 standards. Because HTML5 allows for
mixed-case attributes, and the JavaScript standard for event handlers is mixed case, this
text will use the mixed-case event handlers.
 
Search WWH ::




Custom Search