NOTE : JavaScript is currently supported by the Netscape Navigator (version 2 and above) and Internet Explorer (version 3.0 and above). It is still under development and is liable to change. For more information on JavaScript, visit http://home.netscape.com/ for Netscape's JavaScript information, or http://www.microsoft.com/jscript for Microsoft's 'JScript' JavaScript implementation. The information provided here only details how to include JavaScript scripts within HTML documents, not how to author actual scripts. Such information is well beyond the scope of this reference.

However, a Scripting Reference is now included in this HTMLib. This details various methods of invoking scripts in HTML and also event handlers that can be included in various standard HTML elements. For some more JavaScript information, see the Scripting Reference topics.

A script is embedded in HTML within a <SCRIPT> element.

<SCRIPT>...</SCRIPT>

The text of a script is inserted between <SCRIPT> and its end element.

Attributes within the <SCRIPT> element can be specified as follows:

<SCRIPT LANGUAGE="JavaScript">
</SCRIPT>

The LANGUAGE attribute is mandatory unless the SRC attribute is present and specifies the scripting language. NOTE : Use of the LANGUAGE attribute is important now that Internet Explorer supports JavaScript. In order for the Internet Explorer to know it is to process the script as JavaScript, it needs to be told that it is JavaScript.

The SRC attribute is optional and, if given, specifies a URL that loads the text of a script.

<SCRIPT LANGUAGE="language" SRC="url">

Both attributes may be present.

NOTE : For Netscape to be able to properly use external JavaScript files, the server on which the files are to reside must have the MIME type application/x-javascript mapped into its list of MIME types (with a suitable extension mapped to it - Netscape recommend ".js") for Netscape to properly respond to the script when it is loaded.

Scripts should be placed inside comment fields to ensure that the script is not displayed when the page's HTML is viewed with a browser unaware of the <SCRIPT> element. The entire script is encased by HTML comment elements:

<SCRIPT LANGUAGE="language" SRC="url">
<!-- Begin to hide script contents from old browsers.
Script functions/routines go here
<!-- End the hiding here.-->

For more information about scripts, the language and some examples, see http://home.netscape.com/


Client Pull Dynamic Documents Overview <APPLET>