📄 poll_edit.asp
字号:
<!--#include file="../../include/db.asp"-->
<!--#include file="../../include/admin_check.asp"-->
<!--#include file="power.asp"-->
<%
'********************************************
'本文件中 xml 文件的表示方法
' A.B.C 代表 xml 下的层次结构,C 是 B 的子接点,B 是 A 的子接点
' A:B 代表 xml 下的元素属性,B 是 A 的属性
'
'********************************************
'双引号转换函数 xmlchar 中所有的双引号都用 ~ 号代替,最后转换
function Deal(mystring)
arrName=replace(mystring,"~",chr(34))
Deal=(arrName)
end function
'特殊字符转换程序
function Deal(initstring)
tempstring=replace(initstring,chr(39),"’")
tempstring=Replace(tempstring,"<","<")
tempstring=Replace(tempstring,">",">")
tempstring=replace(tempstring,chr(34),"“")
tempstring=replace(tempstring,chr(32)," ")
deal=(tempstring)
end function
function Dealname(mystring)
arrName=split(Cstr(mystring),chr(34))
Dealname=arrName(1)
end function
action=trim(request.querystring("action"))
if action="add" then
'*********************************************编辑 poll.xml 文件
'载入poll.xml文件
'set xmlFileObject=server.createObject("scripting.fileSystemObject")
'set xmlFile=xmlFileObject.CreateTextFile("poll.xml")
path=server.mappath("poll.xml")
set myDoc=Server.CreateObject("microsoft.xmldom")
myDoc.async=False
myDoc.load(path)
'根节点
set xmlTop=myDoc.documentElement
'得到最后一个节点的<item> 的id 值
set lastNode=xmlTop.lastChild
idValue=lastNode.attributes.getNameditem("id").nodeValue
'插入新节点
set newNode=myDoc.createElement("item")
'设定调查的标题
if trim(request("title"))="" then
Response.Write "<script language=javascript>"
Response.Write "alert('标题不能为空!!');"
Response.Write "history.go(-1);"
Response.Write "</script>"
Response.End
end if
set attNode=myDoc.createAttribute("title")
set attrText=myDoc.createTextNode(deal(request("title")))
attNode.appendChild(attrText)
newNode.attributes.setNamedItem(attNode)
'设定调查的使用状态
set attNode=myDoc.createAttribute("status")
set attrText=myDoc.createTextNode("0")
attNode.appendChild(attrText)
newNode.attributes.setNamedItem(attNode)
'设定新调查的id值
set attNode=myDoc.createAttribute("id")
set attrText=myDoc.createTextNode(idValue+1)
attNode.appendChild(attrText)
newNode.attributes.setNamedItem(attNode)
'设定调查的总投票人数的属性值
set attNode=myDoc.createAttribute("polled")
set attrText=myDoc.createTextNode("0")
attNode.appendChild(attrText)
newNode.attributes.setNamedItem(attNode)
'插入<select>节点
id=1
for each x in request("select")
if trim(x)<>"" then
set selectNode=myDoc.createElement("select")
'插入投票次数<polled>属性
set attNode=myDoc.createAttribute("polled")
set textNode=myDoc.createTextNode("0")
attNode.appendChild(textNode)
selectNode.attributes.setNamedItem(attNode)
'插入<select>节点的<id>属性值
set attNode=myDoc.createAttribute("id")
set textNode=myDoc.createTextNode(id)
attNode.appendChild(textNode)
selectNode.attributes.setNamedItem(attNode)
set textNode=myDoc.createTextNode(x)
selectNode.appendChild(textNode)
newNode.appendChild(selectNode)
id=id+1
end if
next
'插入新节点
set insertNode=xmlTop.insertBefore(newNode,xmlTop.firstChild)
myDoc.save(path)
' Response.Write "<script language=javascript>"
' Response.Write "alert('操作成功!!');"
' Response.Write "window.location.href='poll.asp';"
' Response.Write "</script>"
' Response.End
response.redirect "poll.asp"
end if
%><html>
<head>
<title>深圳育才一小欢迎您!</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/include/page.css" type="text/css">
</head>
<body >
<table width="1" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table width="753" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<!--#include file="../../include/admin_banner.inc"-->
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%"> </td>
<td width="99%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="td1"> </td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="21%" valign="top">
<!--#include file="../../include/admin_left.inc"-->
</td>
<td width="2%" valign="top"> </td>
<td width="77%" height=1 valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td background="/images/middle/m-bg.gif" width="70"><img src="/images/wzgl.gif"></td>
<td background="/images/middle/m-bg.gif" align="right"><img src="/images/middle/pacer1.gif" width="3" height="38"></td>
<td background="/images/middle/m-bg.gif" align="right" valign="middle" width="16"><a href=# onClick="more()"><img src="/images/middle/more.gif" width="16" height="16" border=0 alt="更多"></a></td>
<td background="/images/middle/m-bg.gif" align="right" width="8"><img src="/images/middle/pacer.gif" width="8" height="38"></td>
<td background="/images/middle/m-bg.gif" align="right" valign="middle" width="16"><a href=# onClick="help()"><img src="/images/middle/help.gif" width="16" height="16" border=0 alt="栏目帮助"></a></td>
<td width="6" align="right"><img src="/images/middle/M-r.gif" width="16" height="38"></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -