首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

appendChild如何添加不了

2012-03-18 
appendChild怎么添加不了源代码:html:htmlbodyscript typetext/javascriptxmlDocnew ActiveXObj

appendChild怎么添加不了
源代码:
html:
<html>
<body>
<script type="text/javascript">
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
  xmlDoc.load("e:访问者.xml")
  ewel=xmlDoc.createElement("hehe")
  xmlDoc.getElementsByTagName("会员")[0].appendChild(newel)
</script>
</body>
</html>
访问者.xml:
<?xml version="1.0"?>
<root>
<会员>
<id1><name>ni hao</name><password>775859</password></id1>
<id2><name>gsdfg</name><password>sfg</password></id2>
<id3><name>fsadfdsa</name><password>2423424</password></id3>
<id4><name>你好啊先生</name><password>fdasfsad</password></id4>
</会员>
</root>

问题:为什么 会员 没插入 hehe元素节点

[解决办法]
多了个N
ewel=xmlDoc.createElement("hehe")
xmlDoc.getElementsByTagName("会员")[0].appendChild(newel)
[解决办法]
[color=#FFFFFF]ewel[/color]=xmlDoc.createElement("hehe")
xmlDoc.getElementsByTagName("会员")[0].appendChild([color=#FFFFFF]newel[/color])
[解决办法]
ewel=xmlDoc.createElement("hehe")
xmlDoc.getElementsByTagName("会员")[0].appendChild(newel)
[解决办法]
你是在哪没看到结果? xml文件里?

热点排行