中国最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2

xmldom教程

XML DOM documentElement 属性

阅读 (1673)

XML DOM documentElement 属性


Document 对象参考手册 Document 对象

定义和用法

documentElement 属性返回文档的根节点。

语法

documentObject.documentElement


实例

下面的代码片段使用 loadXMLDoc() 把 "books.xml" 载入 xmlDoc 中,并显示 XML 文档的位置:

实例

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 对象参考手册 Document 对象
关闭
程序员人生