asp.net.ph

Skip Navigation Links

SCRIPT Element | SCRIPT Object

Language References


Specifies a script to run for the page.HTML 4, 4.01, 5

HTML Syntax

Remarks

A script is a type of computer code, or a set of instructions that can directly be executed by a program that understands the language in which the script is written, such as the Web browser.

The SCRIPT element specifies client-side script code, or specifically ECMA-standard JavaScript code that can be run directly in the browser, and is inserted directly into the HTML page.

Although SCRIPT elements can in theory be placed anywhere in the HTML page, functions in the SCRIPT element that will need user interaction must be placed in the HEAD of the document, as then the functions will be available to the document as it is loaded.

SCRIPT to be executed in a certain part of the document must be inserted in the appropriate place in the document BODY where the code will act upon.

Code within the SCRIPT block that is not contained within a function is executed immediately as the page is loaded.

The SCRIPT element can also be used to insert and run code from an external JavaScript file, using the src attribute.

To keep scripts from being displayed on down-level browsers, the SCRIPT block should be nested within a COMMENT block.

The NOSCRIPT element can be used to provide content that is displayed by browsers for which JavaScript is not available, while being ignored by browsers that can understand JavaScript. For example, authors can use NOSCRIPT to provide a warning that the page requires JavaScript.

A SCRIPT element appearing after a FRAMESET element is ignored.

Please see the chapter on Basic Scripting for detailed information on how JavaScript can be used to enhance Web pages.

Members

SCRIPT Members

See Also

Implementing JavaScript in HTML



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note