vote.asp

来自「ASP+SQL2000+」· ASP 代码 · 共 76 行

ASP
76
字号
<% Response.Buffer=True %> 
<!--#include file="conn.asp"-->
<!--#include file="../include/config.asp"-->
<%
if request.QueryString("stype")="" then
	if Request.ServerVariables("REMOTE_ADDR")=request.cookies("IPAddress") then
		response.write"<SCRIPT language=JavaScript>alert('感谢您的支持,您已经投过票了,请勿重复投票,谢谢!');"
		response.write"javascript:window.close();</SCRIPT>"
	else
		options=request.form("options")
		response.cookies("IPAddress")=Request.ServerVariables("REMOTE_ADDR") 
		set rs=server.createobject("adodb.recordset")
		sql="update vote set answer"&options&"=answer"&options&"+1 where IsChecked=1"
		rs.open sql,conn,1,3
		set rs=nothing
	end if
end if
%>
<head>
<title><%=redcaff%>投票结果</title>
<LINK href=site.css rel=stylesheet>
</head>

<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="330" height="48" bordercolor=<%=border%> style="border-collapse: collapse">
<%
total=0
set rs=server.createobject("adodb.recordset")
sql="select * from vote where IsChecked=1"
rs.open sql,conn,1,1
%>
    <tr>
      <td width="100%" height="48" valign="top" colspan="3" align=center><font color="#000000">『<%=redcaff%>』投票结果<br>
        =======================================================<br>
        </font> <font color="#000073"> <%=rs("Title")%></font> </td>  
    </tr>  
    <tr><td valign="top">序号</td>
	<td valign="top">百比分</td>
	<td valign="top">人数</td></tr>
<%
for i=1 to 8
	if rs("Select"&i)<>"" then
		total=total+rs("answer"&i)
	end if
next

%>
<%for i=1 to 8
	if rs("Select"&i)<>"" then
		if total=0 then
			answer=0
		else
			answer=(rs("answer"&i)/total)*100
		end if
%><tr>
      <td valign="top"><%=i%>.<%=rs("select"&i)%>:</td>
	<td valign="top"><img src=images/RSCount.gif width=<%=int(answer*2)%> height=8> <%=round(answer,3)%>%</td> 
<td valign="top"><%=rs("answer"&i)%>人</td>           
<%
	end if
next
%>

        <tr><td colspan="3">
        共有【<%=total%>】人参加投票<br>
        =======================================================</font></center> 
    </td>  
    </tr>  
  </table>  
</div>  
<p align="center">【<a href="javascript:window.close()">关闭窗口</a>】    
<% rs.close     
set rs=nothing     
conn.close     
set conn=nothing %>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?