XML DOM ownerDocument 屬性
Node 對(duì)象
定義和用法
ownerDocument 屬性返回節(jié)點(diǎn)的根元素(document 對(duì)象)。
語法
實(shí)例
下面的代碼片段使用 loadXMLDoc() 把 "books.xml" 載入 xmlDoc 中,并返回第一個(gè) <title> 節(jié)點(diǎn)的根元素:
實(shí)例
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 對(duì)象
更多建議: