XML DOM valueプロパティ


Attr 对象参考手册Attr オブジェクト

定義と用法

value プロパティは属性の値を返します。

構文

attrObject.value


例

次のコードスニペットはloadXMLDoc()「」を xmlDoc に読み込み、category 属性の名前と値を表示します:

例

xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.getElementsByTagName('book'); for(i=0;i<x.length;i++) { document.write(x.item(i).attributes[0].name); document.write(" = "); document.write(x.item(i).attributes[0].value); document.write("<br>"); }

出力:

category = COOKING
category = CHILDREN
category = WEB
category = WEB

試してみる »

Attr 对象参考手册Attr オブジェクト その他の拡張