一段 js操作xml文件 的示例代码
2008-02-01 15:32
495 查看
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.load("Tipsxml/tips.xml");
var firstinfo=xmlDoc.documentElement.selectSingleNode("Class[@name='文章管理']").childNodes;
for(var j=0;j<firstinfo.length;j++)
{
var newOption =window.document.createElement("OPTION");
if(firstinfo[j].getAttribute("name")!="")
newOption.text=firstinfo[j].getAttribute("name");
else
newOption.text="全部子类";
newOption.value=firstinfo[j].getAttribute("code");
drp2.options.add(newOption);
}
以上只是一段 js操作xml文件 的示例代码,大家在实用过程中,请根据情况修改。
希望对大家有启发!
xmlDoc.async = false;
xmlDoc.load("Tipsxml/tips.xml");
var firstinfo=xmlDoc.documentElement.selectSingleNode("Class[@name='文章管理']").childNodes;
for(var j=0;j<firstinfo.length;j++)
{
var newOption =window.document.createElement("OPTION");
if(firstinfo[j].getAttribute("name")!="")
newOption.text=firstinfo[j].getAttribute("name");
else
newOption.text="全部子类";
newOption.value=firstinfo[j].getAttribute("code");
drp2.options.add(newOption);
}
以上只是一段 js操作xml文件 的示例代码,大家在实用过程中,请根据情况修改。
希望对大家有启发!
相关文章推荐
- 对frameset、frame、iframe的js操作示例代码
- js操作iframe兼容各种主流浏览器示例代码
- Jquery操作js数组及对象示例代码
- js操作iframe兼容各种主流浏览器示例代码
- js 父子窗口的表单操作--示例代码
- Jquery操作js数组及对象示例代码
- 使用 Node.js 模拟滑动拼图验证码操作的示例代码
- JS操作cookies示例代码
- Node.JS使用Sequelize操作MySQL的示例代码
- 一段js动态操作table代码
- 对frameset、frame、iframe的js操作示例代码
- (转)一段操作Select的JS代码
- js 给一段代码,给出运行后的最终结果的一些综合情况、
- JS格式化数字保留两位小数点示例代码
- js装载xml文件然后发向服务器的实现代码
- js替代copy(示例代码)
- JS时间相关操作代码
- MFC创建XML文件示例代码
- js 使FORM表单的所有元素不可编辑的示例代码
- js特殊字符过滤的示例代码