XML DOM nodeType 属性
XML DOM Element 对象的 nodeType 属性返回选定节点的节点类型
语法
elementNode.nodeType
| 节点类型 | 节点名称 |
|---|---|
| 1 | Element |
| 2 | Attribute |
| 3 | Text |
| 4 | CDATA Section |
| 5 | Entity Reference |
| 6 | Entity |
| 7 | Processing Instruction |
| 8 | Comment |
| 9 | Document |
| 10 | Document Type |
| 11 | Document Fragment |
| 12 | Notation |
范例
下面的范例从第一个 <title> 元素取得节点类型
xmlDoc=loadXMLDoc("/static/media/dom/books.xml"); x=xmlDoc.getElementsByTagName("title")[0]; document.write(x.nodeType);