还是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
附件:
<?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即刻.
文件另存为*.hta即刻.
作者: kancnspace 发布时间: 2006-03-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28