+ -
当前位置:首页 → 问答吧 → 还是XML文件的保存问题,帮忙解决啊#32

还是XML文件的保存问题,帮忙解决啊#32

时间:2006-03-05

来源:互联网

XML文件:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
</bookstore>

测试文件:(我要添加一条记录,保存时提示没有权限) 好想搞通这个茫茫啊!
<SCRIPT>
function test() {
var xmlDoc=new ActiveXObject("MSXML2.DOMDocument.3.0");
xmlDoc.load("bookstore.xml");
root=xmlDoc.selectSingleNode("bookstore");//查找<bookstore>
xe1=xmlDoc.createElement("book");//创建一个<book>节点
xe1.setAttribute("genre","李赞红");//设置该节点genre属性
xe1.setAttribute("ISBN","2-3631-4");//设置该节点ISBN属性

xesub1=xmlDoc.createElement("title");
xesub1.text="CS从入门到精通";//设置文本节点
xe1.appendChild(xesub1);//添加到<book>节点中
xesub2=xmlDoc.createElement("author");
xesub2.text="候捷";
xe1.appendChild(xesub2);
xesub3=xmlDoc.createElement("price");
xesub3.text="58.3";
xe1.appendChild(xesub3);

root.appendChild(xe1);//添加到<bookstore>节点中
xmlDoc.save("bookstore.xml");
}
</SCRIPT>
<input type=button value=test onclick="test()">
<TABLE align=center border=2>
<TBODY>
<TR>
<TD class=td1 onclick=editCell(this); height=30>欢迎光临</TD>
<TD class=td2 onclick=editCell(this); height=30>[孟宪会之精彩世界]</TD>
<TD class=td3 onclick=editCell(this); height=30>http://lucky.myrice.com</TD>
</TR>
</TBODY>
</TABLE>

操作系统:WINXP_SP2;文件系统FAT32
附件:

作者: phh_huayi   发布时间: 2006-03-05

权限不够

文件另存为*.hta即刻.

作者: kancnspace   发布时间: 2006-03-13

热门下载

更多