TUTORIALFrontendFETCHED
XML DOM documentElement 属性
XML DOM documentElement 属性 Document 对象 定义和用法 documentElement 属性返回文档的根节点。 语法 documentObject.documentElement 实例 下面的代码片段使用 loadXMLDoc() 把 'books.xml' 载入 xmlDoc 中,并显示 XML 文档的位置: 实例 [mycode3 type='js&#..
Updated 7/16/2026
Tutorial detail pages default to noindex.
XML DOM documentElement 属性
Document 对象
定义和用法
documentElement 属性返回文档的根节点。
语法
documentObject.documentElement
实例
下面的代码片段使用 loadXMLDoc() 把 "books.xml" 载入 xmlDoc 中,并显示 XML 文档的位置:
实例
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.documentElement;
document.write("Nodename: " + x.nodeName + "<br>");
document.write("Nodevalue: " + x.nodeValue + "<br>");
document.write("Nodetype: " + x.nodeType);
输出:
Nodename: bookstore
Nodevalue: null
Nodetype: 1
Nodevalue: null
Nodetype: 1
尝试一下 »
Document 对象