Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
You are here: Reference > HTML > attributes > src (script)

src attribute (script)

Browser support:
Sets the location of a file containing scripting code.
JavaScript page for this attribute: src. You can find other example(s) there.

Possible values:

String that sets the URL of the script file. It can be an absolute or relative path as well. Relative paths are relative to the base URL. The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the src attribute:
Code
javascript.js
<head>
    <script type="text/javascript" src="javascript.js"></script>
</head>
<body>
    <button onclick="HelloWorld ();">Call HelloWorld function</button>
</body>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content