- It identifies a block of script in the page.
Which it does depends on the presence of the
src attribute. A
</script> close tag is required in
A script tag can contain below attributes:
attribute is optional. If it is present, then its value is a
url which identifies a
file. The loading and processing of the web page pauses while the browser fetches,
compiles, and executes the file. The content between the
</script> should be blank.
src attribute is not present, then the content text between the
<script> and the
</script> is compiled and executed.
The script should not contain the sequence
because it could be confused with the
</script>. Inserting a backslash
in strings avoids the problem.
Do not use the
<!-- //--> hack with scripts. It
was intended to prevent scripts from showing up as text on the first generation
browsers Netscape 1 and Mosaic. It has not been necessary for many years.
is supposed to signal an HTML comment. HTML Comments should be ignored in
and executed. Also, HTML comments are not to include
so a script that decrements has an HTML error.
HTML Script attribute defer was intended to alter the timing of component loading in pages. It is not well supported and should not be used.