<!--#include file="conn.asp"-->
<%
dim rs,sql,addr0,addr1,addr,vote
addr0=request.servervariables("server_name")
addr1=request.servervariables("url")
addr1=replace(addr1,"Class_votedy.asp","")
addr="http://"&addr0&addr1
set rs=server.createobject("adodb.recordset")

'读取投票项目
if isnull(request("id")) or request("id")="" then
set rs=conn.execute("select top 1 * from voteclass order by id desc")
vote="vote"
else
set rs=conn.execute("select * from voteclass where id="&request("id"))
vote="vote"&request("id")
end if

response.write vote&"="&""""&""&""""&chr(10)

'如果投票不存在则提示出错
if rs.eof then
response.write vote&"="&vote&"+"&""""&"没有该投票;"&""""&chr(10)
response.write "document.write ("&vote&");"
response.end
end if

'如果有投票，则读取相关资料
title=rs("title")
style=rs("style")
classid=rs("id")
rs.close

'读取选择支
sql="select * from vote where class="&classid
rs.open sql,conn,3,1

response.write vote&"="&vote&"+"&""""&"<form name=form"&vote&" method='POST'>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<table border='0' width='100%' cellspacing='0' cellpadding='0'>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<td width='100%' height='25'>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<p align='center'><b>"&title&"<b></td>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<td width='100%'>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<div align='center'>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<center>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<table border='0' width='90%' cellspacing='0' cellpadding='0'>"&""""&chr(10)

'排列选择支
do while not rs.eof
response.write vote&"="&vote&"+"&""""&"<tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<td width='100%'><input type='"&style&"' name='voted' value='"&rs("id")&"' size='20'>"&rs("vote")&"</td>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</tr>"&""""&chr(10)
rs.movenext
loop


response.write vote&"="&vote&"+"&""""&"</table>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</center>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</div>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</td>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<td width='100%' valign='bottom' align='center' height='30'><input type='button' value='投票' name='B1' onclick='tou"&vote&"();'>&nbsp;&nbsp;<input type='button' value='查看' name='B1' onclick=window.open('"&addr&"Class_voteshow.asp?classid="&classid&"','','width=500,height=200,resizable=0,scrollbars=0');></td>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</tr>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"</table></form>"&""""&chr(10)
response.write vote&"="&vote&"+"&""""&"<\script>function tou"&vote&"(){window.open('about:blank','tou','width=500,height=200,resizable=0,scrollbars=0');form"&vote&".action='"&addr&"Class_votetou.asp?classid="&classid&"&style="&style&"';form"&vote&".target='tou';form"&vote&".submit();}</\script>"&""""&chr(10)

'释放对象
rs.close
set rs=nothing
call EndConnection()

response.write "document.write ("&vote&")"&chr(10)
%>