PRB: SRC Attribute of the SCRIPT TagID: Q172924
|
The SRC attribute of the <SCRIPT> tag lets you specify a file as the JavaScript source, rather than embedding the JavaScript in the HTML. Here's an example:
<HEAD>
<TITLE>My Page</TITLE>
<SCRIPT SRC="common.js">
...
</SCRIPT>
</HEAD>
<BODY>
...
This attribute is especially useful for sharing functions among many
different pages. Unfortunately, Internet Explorer 3.x does not support it.
Internet Explorer 4.x and 5 supports the SRC attribute of the <SCRIPT> tag.
=====HTML File=====
<HTML>
<HEAD>
<TITLE>SRC Sample</TITLE>
</HEAD>
<BODY>
<H3> SRC Example </H3><HR>
<FORM>
<SCRIPT LANGUAGE="Javascript" SRC="script.js">
document.write("If you see this text, your browser does not support " +
"the SRC attribute of the <SCRIPT> tag.");
</SCRIPT>
</FORM>
</BODY>
</HTML>
=====script.js=====
document.write("Hello from inside script.js");
Additional query words:
Keywords : kbcode kbIE500 vbObjMdIIE
Version : WINDOWS:3.0,3.01,5.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: August 8, 1999