欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

XML DOM nodeType 屬性

定義和用法

nodeType 屬性返回節(jié)點(diǎn)的類(lèi)型。

語(yǔ)法:

attrObject.nodeType

實(shí)例

在所有的例子中,我們將使用 XML 文件 books.xml,以及 JavaScript 函數(shù) loadXMLDoc()。

下面的代碼片段顯示 category 屬性的節(jié)點(diǎn)名稱(chēng)、節(jié)點(diǎn)值以及節(jié)點(diǎn)類(lèi)型:

xmlDoc=loadXMLDoc("/example/xdom/books.xml");
var x=xmlDoc.getElementsByTagName('book');

for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].nodeName);
document.write(" = ");
document.write(x.item(i).attributes[0].nodeValue);
document.write(" (nodetype: ");
document.write(x.item(i).attributes[0].nodeType + ")");
document.write("<br />");
}

以上代碼的輸出:

category = children (nodetype: 2)
category = cooking (nodetype: 2)
category = web (nodetype: 2)
category = web (nodetype: 2)