XML DOM documentElement 屬性
Document 對(duì)象
定義和用法
documentElement 屬性返回文檔的根節(jié)點(diǎn)。
語(yǔ)法
documentObject.documentElement
實(shí)例
下面的代碼片段使用 loadXMLDoc() 把 "books.xml" 載入 xmlDoc 中,并顯示 XML 文檔的位置:
實(shí)例
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.documentElement;
document.write("Nodename: " + x.nodeName + "
");
document.write("Nodevalue: " + x.nodeValue + "
");
document.write("Nodetype: " + x.nodeType);
輸出:
Nodename: bookstore
Nodevalue: null
Nodetype: 1
嘗試一下 ?
Document 對(duì)象
更多建議: