 |
|
| SCRIPT - client-side JavaScript code |
|
| Description |
|
The SCRIPT tag specifies client-side JavaScript code, which means JavaScript code that runs directly
in the browser. The browser treats everything between the <SCRIPT> and </SCRIPT> tags as script
elements. For example, the browser interprets text within angle brackets as a script element, not as an
HTML element.
You can include SCRIPT tags anywhere in your HTML document. It is a good idea to define
functions in a SCRIPT tag in the header portion of your document, since then the functions will be
available to the document as it is displayed. You can also use SCRIPT tags in the body of your
document to define JavaScript code to be executed in that part of the document.
You can use a NOSCRIPT tag 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, you could
use the NOSCRIPT tag to provide a warning that the page requires JavaScript. |
|
| Syntax |
|
<SCRIPT LANGUAGE="languageName" SRC="location">....</SCRIPT> |
|
| Attributes |
|
LANGUAGE specifies the program language. If the LANGUAGE attribute is not specified, the default value is JavaScript. |
SRC specifies the URL of the script, if you want to load a script from a separate file. The suffix on a location specifies the scripting language. The suffix .js indicates a JavaScript file.
The web server maps the suffix to the MIME time. For JavaScript, the MIME type is "application/x-javascript". |
|
|