要用xml做一个小小的投票栏目?该如何?请指教,在线!

mrrdh007 2003-08-22 10:01:19
投票项包括5.6个复选钮和一个编辑框。
有几个问题:
1。是先写好xml文件,绑定到input控件上,还是动态生成xml文件?
2。xml文件该如何写?元素如何布置?
3。提交投票后,如何在xml文件中进行处理。比如投票数要加1、编辑框里的内容如何提交等等。

有没有相关的资料可以查询?或者相关原代码?
...全文
38 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shanhe 2003-08-22
  • 打赏
  • 举报
回复
定制XML结构,需要哪些元素、节点
设计投票表单
编写cgi/脚本处理投票表单内容,根据提交内容修改XML内容、存储、分析XML存储结果,表达投票结果
mrrdh007 2003-08-22
  • 打赏
  • 举报
回复
vote.xml
<?xml version="1.0" encoding="gb2312" standalone="yes" ?>
<vote>
<option id="1">
<content>论坛</content>
<votenum>0</votenum>
</option>
<option id="2">
<content>快讯</content>
<votenum>0</votenum>
</option>
<input>
<content>缺省</content>
</input>
</vote>
mrrdh007 2003-08-22
  • 打赏
  • 举报
回复
<%
dim A
A=split(request.querystring("option"),",",-1,1)

dim rootelement

Set xmldom = Server.CreateObject("Microsoft.XMLDOM")
xmldom.async=false
xmldom.load(server.mappath("vote.xml"))
set rootelement=xmldom.documentelement

set optionlist=xmldom.getElementsByTagName("option")
for each AO in A
for j=0 to optionlist.length-1
if AO=optionlist.item(j).getAttribute("id") then
idvalue=optionlist.item(j).childnodes.item(1).nodevalue
idvalue=cstr(cint(idvalue)+1)
optionlist.item(j).childnodes.item(1).nodevalue=idvalue
exit for
end if
next
next

set othernode=xmldom.getElementsByTagName("input")
if request.form("other")<>"" then
set newChild=xmldom.createNode(1,"content",request.querystring("other"))
othernode.appendChild(newChild)
end if

xmldom.save(server.mappath("vote.xml"))
%>
帮我看看这个有什么错吗?
mrrdh007 2003-08-22
  • 打赏
  • 举报
回复
具体一点好不?

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧