Name

SRC — NN 3 IE 4 HTML 4

Synopsis

SRC=”URL"

Optional

Imports a file of script statements from an external file. Once the external statements are loaded, the browser treats them as if they were embedded in the main HTML document. This attribute had some support in Internet Explorer 3, but it relied on a specific JScript.dll version, which makes it unreliable to blindly use it in IE 3.

In theory, you should be able to add script statements inside a SCRIPT element that loads an external script library file. In practice, it is more reliable to provide a separate SCRIPT element for each external library file and for in-document scripts.

Current implementations limit the SRC attribute to point to JavaScript external files. Such files must have a .js filename extension, and the server must have the extension and application/x-javascript MIME type set to serve up such files.

Example

<SCRIPT LANGUAGE="JavaScript" SRC="stringParseLib.js"></SCRIPT>

Value

Any valid URL. Current browsers require files whose names end in the .js extension. A complete URL may help overcome difficulties in some earlier browsers that implement this feature.

Default

None.

Object Model Reference

IE

[window.]document.all.elementID.src

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.