Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM isSameNode() Method

XML DOM isSameNode() Method


Node Object Reference Node object


Definition and Usage

The isSameNode() method returns true when the node is the same node as the given node, otherwise it returns false.

Syntax

nodeObject.isSameNode(node)

Parameters Description
node Required. The node to check.

Example

The following code snippet uses loadXMLDoc() to load "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));

Output:

false

Try it »


Node Object Reference Node object