メタコンテンツプロパティ
例
すべてのメタ要素のcontent属性の値を返します。
var x = document.getElementsByTagName("META");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
txt = txt + "Content of "+(i+1)+". meta tag: "+x[i].content+"<br>";
}
定義と使用法
contentプロパティは、メタ要素のcontent属性の値を設定または返します。
content属性は、メタ情報のコンテンツを指定します。
注:このプロパティで使用できる値は、名前の値と httpEquivプロパティによって異なります。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
content | Yes | Yes | Yes | Yes | Yes |
構文
コンテンツプロパティを返します。
metaObject.content
コンテンツプロパティを設定します。
metaObject.content = text
Value | Description |
---|---|
text | The content of the meta information |
戻り値
Type | Description |
---|---|
String | The value of the content attribute of the meta element |
その他の例
例
headの3番目のメタ要素(インデックス2)のcontent属性の値を変更します。
document.getElementsByTagName("META")[2].content = "Bill Mosley";
❮メタオブジェクト