HTML src property
You don't need to write the same script file repeatedly in HTML, you can create JavaScript in a separate file, save it and use the src property reference, see the following example:
Browser support
Src properties are supported by all major browsers.
Definitions and usages
The src property specifies the URL of the external script file.
If you want to run the same JavaScript on multiple pages in your Web site, you should create an external JavaScript file instead of writing the same script over and over again. Save the script file .js the src extension, and then refer to it in the src property in the label.
Note: External script files cannot contain labels.
Note: Refers correctly to the external script file that you written to the script.
The difference between HTML 4.01 and HTML5
No.
Grammar
The property value
value | describe |
---|---|
URL |
The URL of the external script file.
Possible value:
|
HTML and script.html