js可以修改xml里的数据吗

如题所述

<xml id="xmldoc">
<students><count>1</count></students>
</xml>
<script>
function window.onload()
{
alert(xmldoc.xml);
var nodes = xmldoc.documentElement.childNodes;
if (nodes.length > 0)
{
nodes[0].text = parseInt(nodes[0].text)+1;
}
alert(xmldoc.xml);
}
</script>
温馨提示:答案为网友推荐,仅供参考
相似回答