HTML DOM Source Obheto

Source Object

The Source object is a new object in HTML5.

The Source object represents the HTML <source> element.

Access Source Object

You can access the <source> element by using getElementById():

var x = document.getElementById("mySource");

Try it yourself

Create 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

属性 Description
media Set or return the value of the media attribute of the <source> element.
src Set or return the value of the src attribute of the <source> element.
type 设置或返回 <source> 元素中 type 属性的值。

标准属性和事件

Source 对象支持标准属性事件

相关页面

HTML 参考手册:HTML <source> 标签