<%@ Language="Javascript" %>
<%
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
var root=xmlDoc.createElement("information");
xmlDoc.appendChild(root);
for(var i=1;i<=Request.Form.Count;i++)
{
if(Request.Form.Key(i)!="sub")
{
for(var j=1;j<=Request.Form(i).Count;j++)
{
var field=xmlDoc.createElement("field");
var attID=xmlDoc.createAttribute("ID");
attID.text=Request.Form.Key(i);
field.setAttributeNode(attID);
var value=xmlDoc.createElement("value");
value.text=Request.Form(i)(j);
field.appendChild(value);
root.appendChild(field);
}
}
}
var p=xmlDoc.createProcessingInstruction("xml","version='1.0' encoding='gb2312'");
xmlDoc.insertBefore(p,root);
xmlDoc.save(Server.Mappath("information.xml"));
Response.Write("saved information.xml successfully!");
%>
posted on 2007-08-06 23:05
汪杰 阅读(286)
评论(0) 编辑 收藏 引用 所属分类:
asp(javascrpt)