ZVON > References > DOM1 Reference

ownerDocument (attribute)

Owning interface and usage:  
Node.ownerDocument

Member of these other interfaces :  
Attr, CDATASection, CharacterData, Comment, Document, DocumentFragment, DocumentType, Element, Entity, EntityReference, Notation, ProcessingInstruction, Text

Readonly:   yes

Type:   Document

Description:  
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document this is null.


Example:
Text in the first DIV.
Some text in the second DIV.
Some text and element in the third DIV.
We can try another elements. It will be much more interesting.
Text in the last DIV.
Source:
       <div id="doc">
         <div>
           Text in the first DIV.
         </div>
         <div id="DDD" class="secondClass">
           Some text in the second DIV.
         </div>
         <div class="thirdClass">
           Some text and <span id="SSS">element</span> in the third DIV.
         </div>
         <div class="fourthClass">
           We can try <i>another elements</i>.
           It will be much more <b>interesting</b>.
         </div>
         <div>
           Text in the last DIV.
         </div>
       </div>
     
JavaScript:
  var main = document.getElementById('doc');
  var output = main.ownerDocument.documentElement.nodeName;
Output:
desired your browser
HTML