Name
<SCRIPT> — NN 2 IE 3 HTML 4
Synopsis
<SCRIPT>...</SCRIPT>
End Tag: Required
The SCRIPT
element
provides a container for lines of script code written in any
scripting language that the browser is capable of interpreting.
Script statements that are not written inside a function definition
are executed as the page loads; function definitions are loaded but
their execution is deferred until explicitly invoked by user or
system action (events). You can have more than one
SCRIPT element in a document, and you may include
SCRIPT elements written in different script
languages within the same document.
An important shift in attribute syntax is introduced with HTML 4.0.
To specify the scripting language of the statements within a
SCRIPT element, the LANGUAGE
attribute has been used since the first scriptable browsers. HTML 4.0
deprecates that attribute in favor of the TYPE
attribute, whose value is a MIME type. When the
TYPE attribute is widely adopted by browsers, you
may want to include both attributes in documents for long-term
backward compatibility with older browsers.
Newer browsers also allow script statements to be imported into the
document from a document whose URL is specified for the
SRC attribute. Older, nonscriptable browsers
don’t recognize the SCRIPT element and may
attempt to render the script statements as regular HTML content. To
prevent this, wrap the script statements inside HTML block comment
markers. The end-of-comment marker (-->) must be preceded by a JavaScript ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access