HTML script src attribute
Browser Support
All major browsers support the src attribute.
Definition and Usage
src attribute specifies the URL of an external script file.
If you want to run the same JavaScript on the site of several pages, you should create an external JavaScript file, instead of repeating the same scripting. The extension .js script file to be saved, and then refer to it using the src attribute in <script> tag.
Note: The external script file can not contain <script> tag.
Note: The script is written correctly reference your external script file.
Differences between HTML 4.01 and HTML5
no.
grammar
<script src="URL">
Property Value
值 | 描述 |
---|---|
URL | 外部脚本文件的 URL。 可能的值:
|
HTML <script> tag