XML DOM nodeType 属性

Rarrabu ɗanin Document ɗanin

定义和用法

nodeType 属性可返回节点的节点类型。

语法:

documentObject.nodeType

实例

在所有的例子中,我们将使用 XML 文件 books.xml,以及 JavaScript 函数 loadXMLDoc()

以下的代码片段可显示根节点的节点名称和节点类型:

xmlDoc=loadXMLDoc("books.xml");
document.write("Nodename: ")
document.write(" (nodetype: ") xmlDoc.nodeType);

Output:

Nodename: #document (nodetype: 9)

Rarrabu ɗanin Document ɗanin