⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vote.asp

📁 ①后台增加了基本设置功能
💻 ASP
字号:
<!--#include file="Inc/Code.asp" -->
<%
dim Action,ID,VoteType,VoteOption,sqlVote,rsVote
Action=trim(Request("Action"))
ID=Trim(request("ID"))
VoteType=Trim(request("VoteType"))
VoteOption=trim(request("VoteOption"))
If Action = "Vote" And Id<> "" And VoteOption<>"" And Session("Voted") = "" Then
	if VoteType="Single" then
		conn.execute "Update Vote set answer" & VoteOption  & "= answer" & VoteOption & "+1 where ID=" & ID
	else
		dim arrOptions
		if instr(VoteOption,",")>0 then
			arrOptions=split(VoteOption,",")
			dim i
			for i=0 to ubound(arrOptions)
				conn.execute "Update Vote set answer" & cint(trim(arrOptions(i)))  & "= answer" & cint(trim(arrOptions(i))) & "+1 where ID=" & Clng(ID)
			next
		else
			conn.execute "Update Vote set answer" & VoteOption  & "= answer" & VoteOption & "+1 where ID=" & Clng(ID)
		end if
	end if
	session("Voted")="True"
End If
if ID<>"" then
	sqlVote="Select * from Vote Where ID=" & Clng(ID)
else
	sqlVote="select top 1 * from Vote order by ID desc"
end if
Set rsVote = Server.CreateObject("ADODB.Recordset")
rsVote.open sqlVote,conn,1,1
%>
<HTML>
<HEAD>
<TITLE><%Call W_WebSiteName()%>┊<%Call W_WebSiteUrl()%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="Images/style.css" type=text/css rel=stylesheet>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<TABLE cellSpacing=0 cellPadding=0 width=758 align=center border=0>
  <TBODY>
  <TR>
    <TD rowspan="2"><a href="Index.asp"><img src="Images/Logo.gif" alt="企网互联|域名注册|虚拟主机|全能空间|企业网站建设专家|企业网站智能管理系统官方网站" width="160" height="75" border="0"></a></TD>
    <TD width="598"><TABLE cellSpacing=0 cellPadding=0 align=center bgColor=#ffffff 
border=0>
      <TBODY>
        <TR>
          <TD width=418 height="28">&nbsp;</TD>
          <TD vAlign=bottom width=180 background=Images/index_new2.gif>
            <DIV align=center><IMG height=11 src="Images/home.gif" width=13> 设为首页 | <IMG height=12 
      src="Images/ofldr.gif" width=16> 加入收藏</DIV></TD>
        </TR>
      </TBODY>
    </TABLE></TD>
  </TR>
  <TR>
    <TD><img src="Images/Menu1.gif" width="598" height="47" border="0" usemap="#Map"></TD>
  </TR>
  </TBODY></TABLE>
<table width="758" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="756" height="140" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="758" height="140">
        <param name="movie" value="Images/tt.swf">
        <param name="quality" value="high">
        <embed src="Images/tt.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="758" height="140"></embed>
    </object></td>
  </tr>
  <tr>
    <td><img src="Images/pic03.gif" width="758" height="5"></td>
  </tr>
  <tr>
    <td height="445" valign="top"><table width="758" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="195" height="445" valign="top" background="images/bg06.gif"><table width="195" border="0" cellpadding="0" cellspacing="0" class="c">
              <tr>
                <td width="258"><img src="Images/pic40.gif" width="195" height="44"></td>
              </tr>
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="36"><img src="Images/pic42.gif" width="36" height="26"></td>
                      <td width="159" valign="bottom"><font color="#FFFFFF">.</font><strong><font color="#FF0000">网站调查</font></strong></td>
                    </tr>
                    <tr>
                      <td colspan="2"><img src="images/pic41.gif" width="195" height="7"></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td><% call Contact_Type() %><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="36"><img src="Images/pic42.gif" width="36" height="26"></td>
                      <td width="159" valign="bottom"><font color="#FFFFFF">.</font><a href="Download.asp">下载中心</a></td>
                    </tr>
                    <tr>
                      <td colspan="2"><img src="Images/pic41.gif" width="195" height="7"></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
          </table></td>
          <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="44" valign="middle" background="images/bg05.gif"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="b">
                    <tr>
                      <td class="L15"><a href="Index.asp">首页</a> <span class="en_text">&gt;&gt; </span>网站调查</td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td height="16" valign="top"><TABLE width=100% 
                  border=0 align=center cellPadding=5 cellSpacing=1>
                    <TBODY>
                      <TR>
                        <TD height=126 valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                          <tr>
                            <td valign="top">
                              <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="border">
                                <tr align="center" class="title">
                                  <td height="35" colspan="3"><span class="style4">调 查 结 果</span></td>
                                </tr>
                                <tr class="tdbg">
                                  <td><table width="500" border="0" align="center" cellpadding="2" cellspacing="1">
                                      <tr>
                                        <td width="117" align="right"><div align="center" class="style4">调查内容:</div></td>
                                        <td colspan="2"><font color="#FF9900"><%=rsVote("Title")%></font></td>
                                      </tr>
                                      <tr>
                                        <td width="117" align="right"><div align="center" class="style4">总投票数:</div></td>
                                        <td colspan="2"><font color="#FF9900">
                                          <%
  dim totalVote
  totalVote=0
  for i=1 to 8
  	if rsVote("Select" & i)="" then exit for
	totalVote=totalVote+rsVote("answer"& i)
  next
  response.Write(totalVote & "票")
  if totalVote=0 then totalVote=1
  %>
                                        </font> </td>
                                      </tr>
                                      <tr>
                                        <td colspan="3" align="center">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="117" align="center"><span class="style4">投票选项</span></td>
                                        <td width="15" align="right">&nbsp;</td>
                                        <td width="360" align="center"><span class="style4">百分比</span></td>
                                      </tr>
                                      <%
  for i=1 to 8
  	if trim(rsVote("Select" & i) & "")="" then exit for
  %>
                                      <tr>
                                        <td width="117" align="right"><div align="center"><%=rsVote("Select"& i)%></div></td>
                                        <td align="right">&nbsp;</td>
                                        <td><%
	dim perVote
	perVote=round(rsVote("answer"& i)/totalVote,4)
	response.write "<img src='Images/Vote_bg.gif' width='" & round(360*perVote) & "' height='13' align='absmiddle'>"
	perVote=perVote*100
	if perVote<1 and perVote<>0 then
		response.write "&nbsp;0" & perVote & "%"
	else
		response.write "&nbsp;" & perVote & "%"
	end if
	%>
                                        </td>
                                      </tr>
                                      <% next %>
                                  </table></td>
                                </tr>
                              </table>
                              <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td><%
if session("voted")="" then 
		if Session("UserName")<>"" then
			response.write Session("UserName") & ","
		end if 
	    response.Write "<br><br>您还没有投票,请您在此投下您宝贵的一票!"
		response.write "<form name='VoteForm' method='post' action='vote.asp'>"
		response.write "&nbsp;&nbsp;&nbsp;&nbsp;" & rsVote("Title") & "<br>"
		if rsVote("VoteType")="Single" then
			for i=1 to 8
				if trim(rsVote("Select" & i) & "")="" then exit for
				response.Write "<input type='radio' name='VoteOption' value='" & i & "'>" & rsVote("Select" & i) & "<br>"
			next
		else
			for i=1 to 8
				if trim(rsVote("Select" & i) & "")="" then exit for
				response.Write "<input type='checkbox' name='VoteOption' value='" & i & "'>" & rsVote("Select" & i) & "<br>"
			next
		end if
		response.write "<br><input name='VoteType' type='hidden'value='" & rsVote("VoteType") & "'>"
		response.write "<input name='Action' type='hidden' value='Vote'>"
		response.write "<input name='ID' type='hidden' value='" & rsVote("ID") & "'>"
		response.write "&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:VoteForm.submit();'><img src='images/voteSubmit.gif' width='52' height='18' border='0'></a>&nbsp;&nbsp;"
        response.write "<a href='Vote.asp?ID=" & rsVote("ID") & "&Action=Show' target='_blank'><img src='images/voteView.gif' width='52' height='18' border='0'></a>"
		response.write "</form>"
		else
		response.write "<br><br><br>非常感谢你已经投过票了"
end if
dim sqlOtherVote,rsOtherVote
sqlOtherVote="Select * from Vote Where ID<>" & ID & " order by ID desc"
Set rsOtherVote = Server.CreateObject("ADODB.Recordset")
rsOtherVote.open sqlOtherVote,conn,1,1
rsOtherVote.close
set rsOtherVote=nothing
%></td>
                                </tr>
                              </table>
                              <div align="center">
                                <INPUT style="BORDER-RIGHT: #999999 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 12px; BACKGROUND: #d9d9d9; BORDER-LEFT: #ffffff 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: #999999 1px solid" onclick=history.back(-1) type=button value="< 返 回 上 页" name=Submit23>
                              </div>
                              <br>
                              <br>
                              <p></p></td>
                          </tr>
                        </table></TD>
                      </TR>
                    </TBODY>
                </TABLE></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
</table>
<table width="758" height="28" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="34" background="Images/bg07.gif"><table width="72%" border="0" align="right" cellpadding="0" cellspacing="0">
        <tr>
          <td><SPAN class=buttom><%Call W_Copyright()%>&nbsp;&nbsp;<%Call W_Count()%></SPAN></td>
        </tr>
    </table></td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="29,10,103,29" href="About.asp">
  <area shape="rect" coords="126,10,199,29" href="News.asp">
  <area shape="rect" coords="223,10,299,30" href="Product.asp">
  <area shape="rect" coords="319,10,396,30" href="Download.asp">
  <area shape="rect" coords="419,10,493,29" href="Guestbook.asp">
  <area shape="rect" coords="516,10,591,30" href="Contact.asp">
</map>
</BODY></HTML>

⌨️ 快捷键说明

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