HTML and CSS Reference
In-Depth Information
// -->
</script>
For browsers that ignore the <script> tag, the contents are masked
by the comment delimiters <!-- and --> . JavaScript-enabled browsers,
on the other hand, automatically recognize and interpret the JavaScript
statements delimited by the comment tags. By using this skeleton for
all your <script> tags, you can be sure that all browsers handle your
document gracefully, if not completely.
Unfortunately, as we discuss in Chapter 16 , script content for XHTML
documents must be within a special CDATA declaration, rather than
within comments. Hence, HTML browsers won't honor XHTML scripts,
and vice versa. Our only recommendation at this point is to follow the
popular browsers: write in HTML, but use as many of the features of
XHTML as you can in preparation for the future.
You may include more than one <script> tag in a document, located
in either the <head> or the <body> . The JavaScript-enabled browser ex-
ecutes the statements in order. Variables and functions defined within
one <script> tag may be referenced by JavaScript statements in other
<script> tags. In fact, one common JavaScript programming style is
to use a single <script> in the document <head> to define common
functions and global variables for the document and then to call those
functions and reference their variables in other JavaScript statements
sprinkled throughout the document.
 
Search WWH ::




Custom Search