XML DOM isSameNode()Methods
Element object
Definition and Usage
The isSameNode() method checks whether the specified node is the same node as an existing node.
Returns TRUE if the two nodes are the same, otherwise returns FALSE.
Syntax
elementNode.isSameNode(node)
| Parameter | Description |
|---|---|
| node | Required. The node to check. |
Example
The following code snippet usesloadXMLDoc()put "books.xml" Load into xmlDoc and check whether the two nodes are the same node:
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
y=xmlDoc.getElementsByTagName("book")[1];
document.write(x.isSameNode(y));
x=xmlDoc.getElementsByTagName("book")[0];
y=xmlDoc.getElementsByTagName("book")[1];
document.write(x.isSameNode(y));
Output:
false
Try it Yourself »
Element objectother extensions