📄 index.asp
字号:
<!--#include file="cls_DB.asp"-->
<%
thisID=request("thisID")
str="and ShiFou"
if thisID<>"" then
str="and id="&thisid
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投票首页</title>
</head>
<body>
<h3 align="center">在线投票</h3>
<table width="601" height="243" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td width="746" height="30" bgcolor="#FFFFFF">
<table width="100%" border="0">
<tr>
<td width="515"><a href="admin.asp">投票管理</a></td>
<td width="73"> </td>
</tr>
</table></td>
</tr>
<td width="746" height="210" valign="top" bgcolor="#FOFOFO">
<%
openDB
set rst=Server.CreateObject("ADODB.Recordset")
'查询在有效时间内的项目
sql="select * from titles where KaiShiTime<= #" & Date() & "#"&_
"and JieShuTime >= #" & Date() & "# "& str
rst.open sql,conn,1,1
if not rst.eof then
ZhuTi=rst("ZhuTi")
id=rst("id")'读取主题id值
XuanZe=rst("XuanZe")
Counts=rst("Counts")
KaiShiTime=rst("KaiShiTime")
JieShuTime=rst("JieShuTime")
rst.close
set rst=nothing
%>
<form action="TP_do.asp" method="post">
<!--传递主题id值和投票选择形式,供投票处理-->
<input type="hidden" name="Tid" value="<%=id%>">
<input type="hidden" name="XuanZe" value="<%=XuanZe%>">
<table width="558" align="center" >
<tr>
<td width="370">投票主题:<%=ZhuTi%></td>
<%
set rs=Server.CreateObject("ADODB.Recordset")
'查询表options中的Tid与表titles中的主题id 等值的选项
sql="select Oid,options from options where TID="&id
rs.open sql,conn,1,1
xx=rs.recordcount
%>
<td width="176" rowspan="<%=xx+2%>" valign="bottom"> </td>
</tr>
<tr>
<td >
<%
for i=1 to xx
response.Write "<tr><td>["&i&"]<input type="&XuanZe&" name=option value="&rs("Oid")&">"&rs("options")&"</td></tr>"
rs.movenext '传递选项oid的值
next
rs.close
set rs=nothing
%></td>
</tr>
<tr>
<td height="26"><input type="submit" name="Submit" value=" 提交投票 ">
<input type="reset" name="Reset" value=" 重置投票 ">
<a href="counteshow.asp?tid=<%=id%>">投票结果</a> </td>
</tr>
</table>
</form>
<%
else
response.Write("当前没有投票")
end if
%>
</table>
<p><h4 align="center">请选择其他投票项</h4>
<table width="600" align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#9999999">
<tr>
<td height="24" bgcolor="#FFFFFF" colspan="4"> 其他投票</td>
</tr>
<tr bgcolor="#FOFOFO">
<td>投票主题</td>
<td>投票总数</td>
<td>结束时间</td>
</tr>
<%
if id="" then
str1=""
else
str1="and id <> "&id
end if
sql = "Select id, ZhuTi, KaiShiTime,JieShuTime,Counts,ShiFou from titles where KaiShiTime<= #" & Date() & "# and JieShuTime >= #" & Date() & "#"&str1
Set rsl = Server.CreateObject("ADODB.Recordset")
rsl.open sql,conn,1,1
rsl.pagesize=5 '设置一页显示多少条记录
if not rsl.eof then
pageno=request("pageno")
if Not IsNumeric(pageno) or pageno="" then
pageno=1
else
pageno=cint(pageno)
end if
rsl.absolutepage=pageno
else
pageno=0
end if
if not rsl.eof then
for i=1 to rsl.pagesize
response.Write "<tr bgcolor=#F0F0F0><td> <a href='index.asp?thisid="&_
rsl("id")&"'>"&rsl("ZhuTi")&"</a></td><td>"&rsl("Counts")&"票</td><td>"&_
rsl("JieShuTime")&"</td></tr>"
rsl.movenext
'单击主题链接时传递相应的id值给theid
if rsl.EOF then Exit For
next
end if
%>
<tr bgcolor=#F0F0F0><td colspan="4" align="right">
<!--调用分页函数-->
<%=page(rsl.pagecount,pageno,"index.asp",5)%>
</td>
</tr>
</table>
<%
rsl.close
set rsl=nothing
closeDB
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -