📄 edit.asp
字号:
<!--#include file="config.asp"-->
<%
'程序设计by:杨敏:::
'QQ:343872146:::
'email:yangmin@whut.edu.cn:::
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改投票</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="758" border="1" cellpadding="3" cellspacing="0" bordercolor="#99CCFF">
<tr>
<td align="center" bgcolor="#99CCFF">修改投票</td>
</tr>
<tr>
<td>
<%
Call OpenConn
If Request.QueryString("id")="" Then
Response.Write "出现错误,参数未传递!"
Response.End
End If
sql="SELECT toupiao.* FROM toupiao WHERE (((toupiao.id)=" & Request.QueryString("id") & "));"
rs.open sql,conn,3,2
If rs.bof and rs.eof Then
Response.Write("没有您要的投票!")
Else
If Request.QueryString("action")="update" Then
'用户修改完必,更新数据库:::
NewTitle=Request.Form("NewTitle")
NewType=cint(Request.Form("NewType"))
NewMin=cint(Request.Form("NewMin"))
NewMax=cint(Request.Form("NewMax"))
NewText=Request.Form("NewText")
NewText=Replace(NewText,"|","-")'不允许出现“|”号,因为这是专用符号:::
NewText=Replace(NewText,vbCrLf,"|")
i=0:j=0'统计NewText中“|”的个数,保存在j中:::
Do
i=instr(i+1,NewText,"|")
If i>0 Then j=j+1
Loop Until i=0
NewNum=j+1'选项的个数为j+1个:::
rs.Fields("tptitle")=NewTitle
rs.Fields("tptype")=NewType
rs.Fields("optnum")=NewNum
rs.Fields("minsel")=NewMin
rs.Fields("maxsel")=NewMax
rs.Fields("tptext")=NewText
rs.Update
NewText=Replace(NewText,"|",vbCrLf)'用于显示
Else
'并非更新数据库,只是显示修改界面:::
NewTitle=rs.fields("tptitle")
NewType=rs.fields("tptype")
NewNum=rs.fields("optnum")
NewMin=rs.fields("minsel")
NewMax=rs.fields("maxsel")
NewText=rs.fields("tptext")
NewText=Replace(NewText,"|",vbCrLf)
tpNum=rs.fields("tpnum")
End If
%>
<form name="form1" method="post" action="edit.asp?action=update&id=<%=Request.QueryString("id")%>">
<table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#FFFFFF" bordercolorlight="#000000">
<tr>
<td width="50%" class="33black"><b>投票标题:</b><br>
最多200字,汉字、字母、数字都算一个字。</td>
<td width="50%" class="33black"><input name="NewTitle" type="text" id="NewTitle" value="<%=NewTitle%>">
<input name="toupiaoid" type="hidden" id="toupiaoid" value="<%=Request.QueryString("id")%>"></td>
</tr>
<tr>
<td class="33black"><b>类别:</b><br>
单选或多选。</td>
<td class="33black"><input name="NewType" type="radio" value="1"<%If NewType=1 Then%> checked<%End If%>>
单选
<input type="radio" name="NewType" value="2"<%If NewType=2 Then%> checked<%End If%>>
多选</td>
</tr>
<tr>
<td class="33black"><b>最少选择个数:</b><br>
可以限制用户最少要选择的个数,0表示不限制,<br>
对单选类型无效! </td>
<td class="33black"><input name="NewMin" type="text" id="NewMin" value="<%=NewMin%>"></td>
</tr>
<tr>
<td class="33black"><b>最多选择个数:</b><br>
可以限制用户最多要选择的个数,0表示不限制,<br>
对单选类型无效!</td>
<td class="33black"><input name="NewMax" type="text" id="NewMax" value="<%=NewMax%>"></td>
</tr>
<tr>
<td valign="top" class="33black"><b>选项列表:</b><br>
用回车隔开所有可选项,<br>
所有可选项不允许包含竖线“|”,<br>
最后一个项后不用再加回车。</td>
<td class="33black"><textarea name="NewText" cols="40" rows="10" id="NewText"><%=NewText%></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><table width="158" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"> <input name="submit" type="submit" class="button" value="修改"></td>
<td align="center"> <input name="reset" type="reset" class="button" value="重填"></td>
</tr>
</table></td>
</tr>
</table>
</form>
<%
End If
Call CloseConn
%>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -