XML DOM isSameNode () method
Definition and Usage
isSameNode () method returns true when the node with a given node is the same node, otherwise it returns false.
grammar
nodeObject.isSameNode(node)
参数 | 描述 |
---|---|
node | 必需。要检查的节点。 |
Examples
The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc and check whether 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"
Node objects