我需要这个html / javascript文件来显示XML文档直接位于根元素下的多个元素。
这应显示为:
toOf()
相反,它显示为:
The root element has this many direct children: 2
我该怎么做?
这是我正在使用的代码:
The root element has this many direct children: 0The root element has this many direct children: 1
答案 0 :(得分:1)
你的脚本应该是
var xmlDoc = loadXMLDoc("XML65.xml");
document.write("The root element has this many direct children: " + xmlDoc.childNodes.length);
P.S。我强烈建议您熟悉document.write