HTMLDOMソースオブジェクト
ソースオブジェクト
Sourceオブジェクトは、HTMLの<source>要素を表します。
ソースオブジェクトにアクセスする
getElementById()を使用して、<source>要素にアクセスできます。
例
var x = document.getElementById("mySource");
ソースオブジェクトを作成する
document.createElement()メソッドを使用して、<source>要素を作成できます。
例
var x = document.createElement("SOURCE");
ソースオブジェクトのプロパティ
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 |
標準のプロパティとイベント
Sourceオブジェクトは、標準のプロパティとイベントもサポートします。
関連ページ
HTMLチュートリアル:HTML5ビデオ
HTMLチュートリアル:HTML5オーディオ
HTML参照:HTML <source>タグ