XML DOM isSameNode () method
Definition and Usage
isSameNode () method checks the specified node with an existing node is the same node.
If two nodes with the same returns TRUE, otherwise returns FALSE.
grammar
elementNode.isSameNode(node)
参数 | 描述 |
---|---|
node | 必需。要检查的节点。 |
Examples
The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc and check the two nodes are the same node:
Examples
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"
Element object