HTML DOM SourceObject
Source Object
The Source object is new in HTML5.
The Source object represents an HTML <source> element.
Access the Source Object
You can access a <source> element by using getElementById():
var
x = document.getElementById("mySource");
Try it yourself
Create a Source Object
You can create a <source> element by using the document.createElement() method:
var x = document.createElement("SOURCE");
Try it yourself
Source Object Properties
| Property | Description |
|---|---|
| media | Sets or returns the value of the media attribute in a <source> element. |
| src | Sets or returns the value of the src attribute in a <source> element. |
| type | Sets or returns the value of the type attribute in a <source> element. |
Standard Properties and Events
The Source object also supports standardPropertiesandEvents。
Related Articles
HTML Tutorial:HTML5 Video (video)
HTML Tutorial:HTML5 Audio (audio)
HTML Reference Manual:HTML <source> Tag
Other Extensions