您的位置:首页 > Web前端 > JavaScript

一段 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文件 的示例代码,大家在实用过程中,请根据情况修改。

希望对大家有启发!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: