XML DOM ownerDocumentProperty
Element object
Definition and Usage
The ownerDocument property returns the document object to which the selected element belongs.
Syntax
elementNode.ownerDocument
Example
The following code snippet usesloadXMLDoc()put "books.xmlLoad it into xmlDoc, and retrieve the name and node type from the owner document of the first <title> element:
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("title")[0];
x=x.ownerDocument;
document.write("Nodename: " + x.nodeName);
document.write(" (nodetype: " + x.nodeType + ")");
x=xmlDoc.getElementsByTagName("title")[0];
x=x.ownerDocument;
document.write("Nodename: " + x.nodeName);
document.write(" (nodetype: " + x.nodeType + ")");
The code above will output:
Nodename: #document (nodetype: 9)
Try it Yourself »
Element objectother extensions