XML DOM ownerDocument 屬性
Node 對象
定義和用法
ownerDocument 屬性返回節(jié)點的根元素(document 對象)。
語法
實例
下面的代碼片段使用 loadXMLDoc() 把 "books.xml" 載入 xmlDoc 中,并返回第一個 <title> 節(jié)點的根元素:
實例
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("title")[0].ownerDocument;
document.write("Nodename: " + x.nodeName);
document.write(" (nodetype: " + x.nodeType + ")");
上面的代碼將輸出:
Nodename: #document (nodetype: 9)
嘗試一下 ?
Node 對象