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

XML DOM ownerDocument Property

XML DOM ownerDocument Property


Element Object Reference 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 uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and from the first Get the name and node type of the element's owner document:</p>

Example

xmlDoc=loadXMLDoc("books.xml");

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 »


Element Object Reference Element Object