Latest web development tutorials

XML DOM ownerDocument property

Element Object Reference Element object

Definition and Usage

ownerDocument property returns the document object selected element belongs.

grammar

elementNode.ownerDocument

Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc and obtain the name and node type from the owner of the document first <title> element:

Examples

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