📄 show.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="700" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="50%" valign="top"> <%Call ShowTouPiao(2)%> </td>
<td width="50%" valign="top"> <%Call ShowTouPiao(3)%> </td>
</tr>
<tr>
<td valign="top"> <%Call ShowTouPiao(6)%> </td>
<td valign="top"> <%Call ShowTouPiao(7)%> </td>
</tr>
</table>
<%
Sub ShowTouPiao(i)
'显示投示界面,i为投票在数据库中对应的id号:::
Call OpenConn
sql="SELECT toupiao.* FROM toupiao WHERE (((toupiao.id)=" & i & "));"
rs.open sql,conn,3,2
If rs.bof and rs.eof Then
'数据库里没有对应的投票:::
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>没有您要的投票</td>
</tr>
</table>
<%
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")
tpNum=rs.fields("tpnum")
IF NewType=1 Then InputType="radio" Else InputType="checkbox"
If (NewMin>0 or NewMax>0) And NewType=2 Then
'(限制了最少选择个数,或限制了最大选择个数)而且是多选:::
%>
<script language="JavaScript">
<!--
function ChkSel<%=i%>()
{
var p;
p=0;
<%For j=1 to NewNum%>
if(document.frmtoupiao<%=i%>.C<%=j%>.checked) p++;
<%Next%>
<%
If NewMin>0 Then
'限制最小值':::
%>
if(p<<%=NewMin%>) {alert('最少必须选择<%=NewMin%>项,您已经选了'+p+'项');return false;}
<%
End If
%>
<%
If NewMax>0 Then
'限制最大值':::
%>
if(p><%=NewMax%>) {alert('最多只能选择<%=NewMax%>项,您已经选了'+p+'项');return false;}
<%
End If
%>
return true;
}
-->
</script>
<%
End If
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9" height="8"><img src="img/topleft.gif" width="9" height="8"></td>
<td height="8" background="img/topcenter.gif"><img src="img/spacer.gif" width="1" height="8"></td>
<td width="9" height="8"><img src="img/topright.gif" width="9" height="8"></td>
</tr>
<tr>
<td background="img/left.gif"><img src="img/spacer.gif" width="1" height="8"></td>
<td><form action="view.asp?id=<%=i%>" method="post" name="frmtoupiao<%=i%>" id="frmtoupiao1"<%
If (NewMin>0 or NewMax>0) And NewType=2 Then
'(限制了最少选择个数,或限制了最大选择个数)而且是多选:::
Response.Write(" OnSubmit=""javascript:return ChkSel" & i & "();""")
End If
%>>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="33black"><%=NewTitle%>
<input name="toupiaoid" type="hidden" id="toupiaoid" value="<%=i%>">
<input name="optnum" type="hidden" id="optnum" value="<%=NewNum%>">
<input name="minsel" type="hidden" id="minsel" value="<%=rs.fields("minsel")%>">
<input name="maxsel" type="hidden" id="maxsel" value="<%=rs.fields("maxsel")%>">
<input name="tytype" type="hidden" id="tytype" value="<%=rs.fields("tptype")%>"></td>
</tr>
<%
l=0'开始提取tptext中的每一个选项内容
For j=1 to NewNum
k=l
l=instr(l+1,NewText,"|")
%>
<tr>
<td width="4%"><input type="<%=InputType%>" name="C<%If NewType=2 Then Response.Write(j)%>" value="<%=j%>"></td>
<td width="96%"><%If l>0 Then Response.Write(mid(NewText,k+1,l-k-1)) Else Response.Write(right(NewText,len(NewText)-k))%></td>
</tr>
<%
Next
%>
<%
If (NewMin>0 or NewMax>0) And NewType=2 Then
'(限制了最少选择个数,或限制了最大选择个数)而且是多选:::
%>
<tr>
<td colspan="2" class="redtd">注意,本投票对选择有限制,
<%If NewMin>0 Then%>最少选<%=NewMin%>项<%Else%>最少不限制<%End If%>,
<%If NewMax>0 Then%>最多选<%=NewMax%>项<%Else%>最多不限制<%End If%>!</td>
</tr>
<%
End If
%>
<tr>
<td colspan="2" align="center"><input name="Submit" type="submit" class="button" value="投票">
<input name="Submit" type="button" class="button" value="查看结果" onClick="window.location='view.asp?id=<%=i%>'"></td>
</tr>
</table>
</form></td>
<td background="img/right.gif"><img src="img/spacer.gif" width="1" height="8"></td>
</tr>
<tr>
<td><img src="img/bottomleft.gif" width="9" height="8"></td>
<td background="img/bottomcenter.gif"><img src="img/spacer.gif" width="1" height="8"></td>
<td><img src="img/bottomright.gif" width="9" height="8"></td>
</tr>
</table>
<%
End IF
Call CloseConn
End Sub
%>
<%
set rs=nothing
set conn=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -