src
Definition and Usage
The src attribute specifies the URL of an external script file.
If you want to run the same JavaScript on several pages in a web site, you should create an external JavaScript file, instead of writing the same script over and over again. Save the script file with a .js extension, and then refer to it using the src attribute in the <script> tag.
This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a document. If a script
element has a src
attribute specified, it should not have a script embedded inside its tags.
Attribute Values
Value | Description |
---|---|
URL | The URL of the external script file.Possible values:
|