Using JavaScript
JavaScript programs are embedded directly into an HTML page. There are two ways to embed JavaScript into an HTML page. The HTML page below demonstrates the general guidelines
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- The main part of the script goes here, including all of its functions. -->
</SCRIPT>
</HEAD>
<BODY>
<!-- The body of the HTML document goes here, including new HTML tags that let a
\\user interact with the JavaScript program above -->
</BODY>
</HTML>
The alternate to using the LANGUAGE attribute is to tell the SCRIPT tag to load a script from a separate file or URL (rather than including it within the HTML page). For example this tag offers an easy way to reuse a single script across several pages. The syntax for this is
<SCRIPT SRC="http://thescript.js"> ... </SCRIPT>
In order to hide your JavaScript program from, other browsers you should enclose the contents of your scripts in HTML comment tags. In that way, a non- Netscape browser won’t display the text of your script. You can do that like this:
<SCRIPT LANGUAGE="JavaScript">
<!-- begin hiding script
Script Contents
// end hiding script -->