g=''2'' cellspacing=0'' bordercolorligh=''#000000''"); document.write(" bordercolordark=''#ffffff'' width=''100%'' align=''center''><tbody>"); document.write("<tr><td colspan=''2'' align=''center''><b><%=server.htmlencode(question)%></b></td></tr>"); <% sql="select vote_no,vote_answer from survey_vote where vote_id="&id ''查询答案的SQL searchtable my,sql,rs ''执行查询 if not rs.eof then ''如果有答案,就输出 for i=1 to rs.recordcount %> document.write("<tr><td align=''right''><input name=''res'' type=''"); <% if surveytype then ''判断类型,显示单选或者多选 %> document.write("checkbox"); <%else%> document.write("radio"); <%end if ''下面这句输出答案的文字和提交的值(vote_no)%> document.write("'' value=<%=rs("vote_no")%>></td><td><%=rs("vote_answer")%></td></tr>"); <% rs.movenext next ''下面几句输出一个隐藏的参数,传递问题编号(id) ''并用一个JS函数来定义点击查看后的链接 %> document.write("<tr><td colspan=''2'' align=''center''><input type=''hidden'' name=''id'' value=''<%=id%>''>"); document.write("<input type=''submit'' class=button value=''投票''> "); document.write("<input type=button class=button value=''查看'' onclick=''jump(<%=id%>)''>"); document.write("</td></tr></tbody></table></form>"); function jump(id){ window.open("survey_vote.asp?id="+id,"survey") } <% end if end if end if closetable rs closedb my end if %>
在surveycode.asp完成后,我们实现上已经确定了以下几点:
1、在survey_vote.asp中,如果querystring参数id有值,则是查看结果;
2、在survey_vote.asp中,如果form参数id有值,则要先进行统计;
3、在survey_vote.asp中,提交来的form参数res是答案的编号vote_ 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页 |