<!--#include file="../conn.asp"-->
<%
dim voteArr,voteItemArr
	Set rs = Server.CreateObject("Adodb.RecordSet")				 
	rs.Open "Select id,title from vote order by id asc",conn,3,1
	if not rs.eof then
		voteArr=rs.GetRows()
	else
		response.Write("没有找到记录")
		response.End()
	end if
	rs.close
	set rs=nothing
''''''''''''''''''''''''''''''''''初使化''''''''''''''''''''''''''''
dim tempJsStr
tempJsStr=""
tempJsStr=tempJsStr&"document.write('<FORM method=""POST"" name=""VoteForm"" target=""_blank"" action=""vote/voteok.asp"" style=""margin:0 0 0 0;"">');"&Chr(10)
tempJsStr=tempJsStr&"document.write('<table width=""90%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""style5"">');"&Chr(10)
tempJsStr=tempJsStr&"document.write('<tr>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('  <td class=""style3"">青年群体购房调查</td>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('</tr>');"&Chr(10)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'开始按vote循环
for votei=0 to ubound(voteArr,2)
	'初使化vote头	
	tempJsStr=tempJsStr&"document.write('<tr>');"&Chr(10)
    tempJsStr=tempJsStr&"document.write('<td><table width=""94%""  border=""0"" cellpadding=""0"" cellspacing=""0"" class=""style5"">');"&Chr(10)
    tempJsStr=tempJsStr&"document.write('  <tr>');"&Chr(10)
    tempJsStr=tempJsStr&"document.write('    <td width=""13%"">"&(votei+1)&"、</td>');"&Chr(10)
    tempJsStr=tempJsStr&" document.write('   <td>"&voteArr(1,votei)&"</td>');"&Chr(10)
    tempJsStr=tempJsStr&"document.write('  </tr>');"&Chr(10)
	Set rs = Server.CreateObject("Adodb.RecordSet")				 
	rs.Open "Select id,itemName from voteitem where voteid="&voteArr(0,votei),conn,3,1
	if not rs.eof then
		voteItemArr=rs.GetRows()
		rs.close
		set rs=nothing
		for i=0 to ubound(voteItemArr,2)
			tempJsStr=tempJsStr&"document.write('<tr>');"&Chr(10)
			tempJsStr=tempJsStr&"document.write('<td><input type=""radio"" name=""vote"&voteArr(0,votei)&""" value="""&voteItemArr(0,i)&"""></td>');"&Chr(10)
			tempJsStr=tempJsStr&"document.write('<td>"&voteItemArr(1,i)&"</td>');"&Chr(10)			
			tempJsStr=tempJsStr&"document.write('</tr>');"&Chr(10)

		next
	else
		rs.close
		set rs=nothing
	end if
	'vote 尾
	tempJsStr=tempJsStr&"document.write(' </table></td></tr>');"&Chr(10)
next

tempJsStr=tempJsStr&"document.write('<TR>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('    <TD align=right><div align=""center"">');"&Chr(10)	
tempJsStr=tempJsStr&"document.write('        <input type=image src=""images/voteSubmit.gif"">&nbsp;&nbsp;');"&Chr(10)
tempJsStr=tempJsStr&"document.write('        <a href=\'vote/votelist_s.asp?id=1\' target=""_blank""><img src=""images/voteView.gif"" border=0></a>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('    </div></TD>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('</TR>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('</TABLE>');"&Chr(10)
tempJsStr=tempJsStr&"document.write('</FORM>');"&Chr(10)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set file_w = fs.CreateTextFile(server.mappath("../vote/vote.js"),true)	
file_w.WriteLine(tempJsStr)
file_w.close
set file_w=nothing
response.write("成功生成投票JS文件")
call connclose()
%>