Attribute for <SCRIPT ...>

SRC sets an external source for the script. If SRC is set then the contents of the <SCRIPT ...> element are ignored. For example, the following code loads a script located in the file myscript.js:

<SCRIPT TYPE="text/javascript" SRC="myscript.js"></SCRIPT>

The script in myscript.js writes out the current date and time to the page:

SRC allows you to create script libraries that can be used in many pages in your web site. There were some problems with the use of SRC for quite a while. The folks in Redmond were apparently drinking too much latte because MSIE failed to support SRC until version4, making for a heap of webmaster headaches. Fortunately the overwhelming majority of people have evolved to MSIE 4 or later so SRC is a reasonably stable attribute now.

About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.