function commonParentNode(oNode1, oNode2) {
if(oNode1.contains(oNode2)) return oNode1;
else return commonParentNode(oNode1.parentNode, oNode2);
}
The contains() method returns true if a node is a descendant of a node.
The contains() method returns false if not.
The parentNode property returns the parent node of an element or node.
The parentNode property is read-only.



京公网安备 11010502036488号