Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

<script>

<script
charset=charset
defer
language=javascript|jscript|vbs|vbscript
src=filename
title=text
type=MIME type
</script>

Specifies the inclusion of a script such as VBScript or JavaScript. You can reference external scripts, written as text files, using <script> with the src= attribute. The scripts themselves appear in the tag's container.

Authors often enclose the scripts in the <script> tag within the comment tag (<!-- ... -->). This prevents browsers that do not recognise the <script> tag from displaying the scripts as plain text in the browser.

You must enter the end-tag.

Attributes

charset=charset

The character set encoding. An example is ISO-8859-1 (often called Latin-1). This character set covers the most common characters in western European languages.

defer

Useful for delaying scripts that pre-load pictures or display scrolling messages in the status bar. It means that the script is not going to generate any page content (e.g., no "document.write" in javascript). Current browsers do not generally support this attribute.

language=javascript|jscript|vbs|vbscript

The language that you used to write the script. One of:

Value…

Description…

Jscript

Specifies the language as JScript™

javascript

Specifies that the script is written in JavaScript

Vbs

Specifies the language as VBScript

Vbscript

Specifies that the script is written in VBScript

src=filename

Specifies an external file that contains scripts. These scripts are available just as if they had been written directly into the page, and they follow the same rules as any script that might appear within the page.

title=text

For information only. Some browsers display the title when you move the mouse over the tag (like a tool tip).

type=MIME type

Specifies the Internet media type for style notation.