jump

HTML: The Markup Language (an HTML language reference)

scriptembedded script # T

The script element enables dynamic script and data blocks to be included in documents.

Permitted contents #

Permitted attributes #

global attributes
Any attributes permitted globally.
type = MIME type #
The language of the script or format of the data.
A string that identifies a valid MIME media type as defined in [RFC 2046].
language = string OBSOLETE #
Specifies that the language of the script is JavaScript.
src = non-empty URL potentially surrounded by spaces #
The address of the external script to use.
defer = "defer" or "" (empty string) or empty #
Specifies that script should be executed after the document has been parsed.
async = "async" or "" (empty string) or empty NEW #
Specifies that the script should be executed asynchronously, as soon as it becomes available.
charset = character encoding name #
The character encoding of the external script.
A case-insensitive match for any character set name for which the IANA [Character Sets] registry has a Name or Alias field labeled as “preferred MIME name”; or, if none of the Alias fields are so labeled, a case-insensitive match for a Name field in the registry.

Additional constraints and admonitions #

Tag omission #

A script element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain metadata elements, any element that can contain phrasing elements

DOM interface #

interface HTMLScriptElement : HTMLElement {
           attribute DOMString src;
           attribute boolean async;
           attribute boolean defer;
           attribute DOMString type;
           attribute DOMString charset;
           attribute DOMString text;
};

Typical default display properties #

script {
display: none; }