XML DOM textContent プロパティ
Attr オブジェクト
定義と用法
textContent プロパティは、属性のテキスト内容を設定するか返します。
構文
例
次のコードは、loadXMLDoc() を使用して xmlDoc に
"books.xml" をロードし、
category 属性のテクスト内容を返します:
例
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].textContent);
document.write("<br />");
}
|
出力:
試してください »
|
Try-It-Yourself デモ
textContent - Set the textual content of an attribute
Attr オブジェクト
|