XML DOM nodeValue 属性
定义和用法
nodeValue 属性根据节点的类型设置或返回节点的值。
Fassar:
attrObject.nodeValue
shafaranci
a dukkanin kowace, a na zaiwa XML fannu books.xmlwa daidai, kuma JavaScript fannu loadXMLDoc()。
下面的代码片段显示 category 属性的节点名称、节点值以及节点类型:
xmlDoc=loadXMLDoc("/example/xdom/books.xml"); var x=xmlDoc.getElementsByTagName('book'); for(i=0;ix.item(i).attributes[0].nodeValue); document.write(" (nodetype: "); document.write(x.item(i).attributes[0].nodeType + ")"); document.write("
"); }
以上代码的输出:
category = children (nodetype: 2) category = cooking (nodetype: 2) category = web (nodetype: 2) category = web (nodetype: 2)