HTML and CSS Reference
In-Depth Information
EXPLANATION ( CONTINUED )
3
The document.write method displays this line in the page. Any HTML tags inserted
in the quoted strings will be handled by the HTML renderer. JavaScript does not
know how to interpret HTML by itself. If the browser supports JavaScript, the line
Welcome to Maine! will appear just above the image. If the browser does not sup-
port JavaScript, or has it disabled, this section of code is ignored. See the two ex-
amples of output shown in Figures 2.12 and 2.13.
4
This line starts with two slashes, the start of a JavaScript comment. This is done
so that if JavaScript is interpreting this section, it won't see the HTML closing
comment tag, --> . Why don't we want JavaScript to see the closing tag if it could
see the opening tag? Because JavaScript would see the double dash as one of its
special operators, and produce an error. Netscape's error:
5
The JavaScript program ends here with its closing </script> tag.
Figure 2.12 Example 2.5 output in a JavaScript-disabled browser.
Search WWH ::




Custom Search