javascript Node nodeType
| nodeType | NN 6 IE 5 DOM 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Read-only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Returns an integer that corresponds to a node type as specified in the W3C DOM. This is the preferred property to use to test a node object for its type (rather than the nodeName property values). Every node type has a value, but not all browsers that support the nodeType property support all node types as objects. The integer values have corresponding constants associated with them, which you can use to make more verbose, but easier-to-read script comparisons for node type processing (see the ATTRIBUTE_NODE property). Note that there is no way to distinguish element types (e.g., root Element node versus an HTMLElement node) via the nodeType property. Also note that IE 6 in Windows erroneously reports a DOCTYPE element as a comment node type. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Example | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (document.getElementById("elementID").firstChild.nodeType == 1) {
// process as an element
}
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Value | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Integer values according to the following table. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Default | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Node-specific. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
