Source src Property
Example
Return the URL of a media file:
var x = document.getElementById("mySource").src;
Try it Yourself »
Description
The src property sets or returns the value of the src attribute in a <source> element.
The src attribute specifies the URL of the media file to play.
Browser Support
Property | |||||
---|---|---|---|---|---|
src | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the src property:
sourceObject.src
Set the src property:
sourceObject.src = URL
Property Values
Value | Description |
---|---|
URL | Specifies the URL of the media file. Possible values:
|
Technical Details
Return Value: | A String, representing the URL of the media file. Returns the entire URL, including the protocol (like http://) |
---|
Related Pages
HTML reference: HTML <source> src attribute
❮ Source Object