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

📄 vote.asp

📁 第一次开发医院管理
💻 ASP
字号:
<!--#include file="conn.asp" -->
<html>
<head>
<link href="../main.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<% 
if session("vote")=true then
call view()
else
if request("action")="vote" then
call vote()
else
call main()
end if
end if
sub main()
set rs = conn.execute("select top 1 * from vote order by id desc") %>
<table width="100%" border="0">
  <tr><td>
<form name="form1" method="post" action="vote.asp?action=vote">
        <table width="100%" border="0">
          <tr> 
    <td><%= rs("question") %>
              <input name="id" type="hidden" id="id" value="<%= rs("id") %>"></td>
  </tr>
  <tr> 
            <td height="20">
<input name="q" type="radio" value="aa" checked>
              <%= rs("qa") %></td>
  </tr>
  <tr> 
            <td height="20">
<input type="radio" name="q" value="ab">
              <%= rs("qb") %></td>
  </tr>
  <tr> 
            <td height="20">
<input type="radio" name="q" value="ac">
              <%= rs("qc") %></td>
  </tr>
  <tr>
            <td height="20">
<input type="radio" name="q" value="ad">
              <%= rs("qd") %></td>
  </tr>
  <tr> 
            <td height="20" align="center"> 
              <input type="submit" name="Submit" value="提交">
            </td>
  </tr>
</table>
 </form>
 </td></tr>
 </table>
<% 
rs.close
set rs = nothing
end sub
sub vote
if session("vote")=true then
Response.Write("您已经投过票了。")
else
sql = "select * from vote where id="&request("id")
set rs = Server.CreateObject("Adodb.Recordset")
rs.open sql,conn,3,3
dim a
a=Trim(Request.Form("q"))
rs(a)=rs(a)+1
rs("all")=rs("all")+1
rs.update
rs.close
set rs = nothing
session("vote")=true
call view()
end if
end sub
sub view()
sql = " select top 1 * from vote order by id desc"
set rs = Server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width="100%" height="110" border="0">
  <tr> 
    <td colspan="2"><%= rs("question") %></td>
  </tr>
  <tr> 
    <td width="40%" height="20"><%= rs("qa") %></td>
    <td width="60%" height="20"><img src="bar1.gif" width="<% =(rs("ab")/rs("all"))*100 %>%" height="10"></td>
  </tr>
  <tr> 
    <td width="40%" height="20"><%= rs("qb") %></td>
    <td width="60%" height="20"><img src="bar2.gif" width="<% =(rs("ab")/rs("all"))*100 %>%" height="10"></td>
  </tr>
  <tr> 
    <td width="40%" height="20"><%= rs("qc") %></td>
    <td width="60%" height="20"><img src="bar3.gif" width="<% =(rs("ac")/rs("all"))*100 %>%" height="10"></td>
  </tr>
  <tr> 
    <td width="40%" height="20"><%= rs("qd") %></td>
    <td width="60%" height="20"><img src="bar4.gif" width="<% =(rs("ad")/rs("all"))*100 %>%" height="10"></td>
  </tr>
</table>
<%
end sub%>


</body>
</html>

⌨️ 快捷键说明

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