Webmaster

JavaScript : Overview
Contents ]
Claude Levior

Integration of Scripts in HTML Pages

JavaScript scripts are easily added to HTML code. All you have to do is place the required code between the <SCRIPT> and </SCRIPT> tags, which in turn must be inserted in the page head section denoted by the HEAD element. This is what it should look like:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript1.3">
   // JavaScript script
</SCRIPT>
</HEAD>
<BODY>
</HTML>

Points to note. Please note that the LANGUAGE attribute of the SCRIPT tag is optional as JavaScript is the default scripting language for browsers.

Another possibility: some JavaScript commands can be embedded in an HTML tag as attributes.

And finally, a JavaScript program can also be stored in an external text file, the name of which ends with the .js extension. You must then insert a reference to the file in the Web page from which the script will be called and executed. But we will return to that later ...