Script src property
Get the URL of the external script:
x The output is:
Try it out . . .
Definitions and usages
The src property sets or returns the value of the script's src property.
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.
Browser support
Src properties are supported by all major browsers.
Grammar
Return the src property:
Set the src property:
The property value
value | describe |
---|---|
URL |
The URL of the external script file.
Possible value:
|
Technical details
Return value: | String, which represents the URL of the external script file. Returns the full URL, including protocols, such as http://. |
---|
Related articles
HTML Reference Manual: HTML slt;script> src property