Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Source object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Source object


Source object

The Source object is new in HTML5.

The Source object represents an HTML-lt;source-and-gt; element.

Access the Source object

You can use getElementById() to access the elements:

varx = document.getElementById("mySource"); try it

Create a Source object

You can use the document.createElement() method to create an element:

var x = document.createElement("SOURCE"); try it

Source object properties

Attributes describe
media 设置或返回 <source> 元素中 media 属性的值。
src 设置或返回 <source> 元素中 src 属性的值。
type 设置或返回 <source> 元素中 type 属性的值。

Standard properties and events

Source objects also support standard properties and events.


Related articles

HTML tutorial: HTML5 Video

HTML tutorial: HTML5 Audio (audio).

HTML Reference Manual: HTML .lt;source> Tags