本人现在想用javascript读写数据,比如读写txt,xml文件等,用javascript读xml文档已经实现,但写xml文档一直不行,请问javascript可以写数据吗?

解决方案 »

  1.   


    可以  调fso或其他组件但要有权限
      

  2.   

    可以,写完调用save方法保存即可
      

  3.   

    <script>  
      function   additem(){  
            var   xmldom   =   new   ActiveXObject("Microsoft.XMLDOM");  
            xmldom.async   =   false;  
            xmldom.load("youxmlfile.xml");  
            var   xnode   =   xmldom.documentElement.createElement("Item");  
            xnode.text   =   "abc";  
            var   newAtt   =   xnode.createAttribute("ID");  
            newAtt.text   =   "A";  
            xmldom.documentElement.appendChild(xnode);  
            alert(xmldom.xml);  
      }  
    </script>