HTML 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 version 4, 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.