HTML 4 script Tag

Also see HTML5 <script> Tag.

This page contains information about the HTML 4 version of this element. For a more up to date version, see HTML5 <script> Tag.


The HTML script tag is used for declaring a script (such as JavaScript) within your HTML document.

Also see the HTML noscript tag for providing content to browsers that don't support your scripting language.

Example

Attributes

Attributes specific to this tag:
AttributeDescription
nameDefines the name of the parameter.
srcSpecifies a URI/URL of an external script.
typeSpecifies the scripting language as a content-type (MIME type).
languageSpecifies the scripting language, however, this attribute has been deprecated. Use the type attribute instead.
deferDeclares that the script will not generate any content. Therefore, the browser/user agent can continue parsing and rendering the rest of the page.
Other Attributes:
AttributeDescription
charsetDefines the character encoding that the script uses.

HTML5 Tags

The information on this page is based on HTML version 4.01. Most modern browsers now support HTML5, which is the next version of HTML after HTML 4.01.

See HTML5 <script> Tag for the HTML5 version of the above element.

Also see this list of HTML 5 tags for the latest version of HTML.