📄 surveyshow.asp
字号:
<!--#include file="../Include/Config.asp"-->
<link rel="stylesheet" href="../Css/Style.css" type="text/css" />
<%
'问卷显示和保存页,系统核心文件
'检验问卷开放、审核、密码、IP限制等
dim Survey_id,Survey_content,i,Question_type
dim Survey_question,Question_answer,j
Question_type=""
Survey_id=request.QueryString("Survey_id")
call CheckNum(Survey_id)
sql="select * from [Survey] where Survey_id="&Survey_id
rs.open sql,conn,1,3
if rs.eof then
call ShowAlert("参数错误","")
end if
response.Write("<title>"&siteName&"---问卷查看---"&rs("Survey_name")&"</title>")
Survey_content=rs("Survey_content")
Survey_name=rs("Survey_name")
Survey_ipRepeat=rs("Survey_ipRepeat")
rs.close
'显示网页keywords和description
sql="select SysSet_keyword,SysSet_descrip from [SysSet] where SysSet_use=true"
rs.open sql,conn,1,1
response.Write("<meta http-equiv=""keywords"" content="""&rs(0)&""" />")
response.Write("<meta http-equiv=""description"" content="""&rs(1)&""" />")
rs.close
%>
<%
'假设所以发布的问卷均符合要求:问卷下有至少1道的问题,每个问题下均有多个选项
'----------------------------------------------------------
'显示问卷
'----------------------------------------------------------
response.Write("<title>"&siteName&"---"&Survey_name&"</title>")
response.Write("<div id=""surveyBox"">")
response.Write("<div class=""center"">")
response.Write("<div class=""name"">")
response.Write(Survey_name&"<br/>")
response.Write("</div>")
if Survey_content<>"" then
Survey_question=split(Survey_content,",")
response.Write("<form name=""form1"" action="""" method=""post"">")
response.Write("<ul type=""1"">")
for i=0 to ubound(Survey_question)
sql="select * from [Question] where Question_id="&Survey_question(i)
rs.open sql,conn,1,1
if not rs.eof then
select case rs("Question_type")
case "1"
response.Write("<li>"&rs("Question_content")&"</li>")
response.Write("<ul type=""1"">")
if not rs("Question_answer")="" then
if Question_type<>"" then'将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
' Question_img=split(rs("Question_img"),"&")
for j=0 to ubound(Question_answer)
response.Write("<li><input type=""radio"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>")
'if Question_img(j)<>"null" then
'response.Write("<img src="""&Question_img(j)&""">")
' end if
next
else
response.Write("该题目下无选项")'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
response.Write("</ul><br/>")
case "2"
response.Write("<li>"&rs("Question_content")&"</li>")
response.Write("<ul type=""1"">")
if not rs("Question_answer")="" then
if Question_type<>"" then '将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
' Question_img=split(rs("Question_img"),"&")
for j=0 to ubound(Question_answer)
response.Write("<li><input type=""checkbox"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>")
'if Question_img(j)<>"null" then
'response.Write("<img src="""&Question_img(j)&""">")
' end if
next
else
response.Write("该题目下无选项")'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
response.Write("</ul><br/>")
case "3"
response.Write("<li>"&rs("Question_content")&"</li>")
response.Write("<ul type=""1"">")
if not rs("Question_answer")="" then
if Question_type<>"" then'将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
' Question_img=split(rs("Question_img"),"&")
for j=0 to (ubound(Question_answer)-1)
response.Write("<li><input type=""radio"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>")
' if Question_img(j)<>"null" then
' response.Write("<img src="""&Question_img(j)&""">")
' end if
next'输出最后一个文本类型的
response.Write("<li><input type=""radio"" name=""answer"&Survey_question(i)&""" value="""&ubound(Question_answer)&""">"&Question_answer(ubound(Question_answer))&"<input type=""text"" name=""answer"&Survey_question(i)&"_2""></li>")
else
response.Write("该题目下无选项")'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
response.Write("</ul><br/>")
case "4"
response.Write("<li>"&rs("Question_content")&"</li>")
response.Write("<ul type=""1"">")
if not rs("Question_answer")="" then
if Question_type<>"" then '将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
' Question_img=split(rs("Question_img"),"&")
for j=0 to (ubound(Question_answer)-1)
response.Write("<li><input type=""checkbox"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>")
' if Question_img(j)<>"null" then
' response.Write("<img src="""&Question_img(j)&""">")
' end if
next'输出最后一个文本类型的
response.Write("<li><input type=""checkbox"" name=""answer"&Survey_question(i)&""" value="""&ubound(Question_answer)&""">"&Question_answer(ubound(Question_answer))&"<input type=""text"" name=""answer"&Survey_question(i)&"_2""></li>")
else
response.Write("该题目下无选项")'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
response.Write("</ul><br/>")
case "5"
response.Write("<li>"&rs("Question_content")&"</li><br>")
response.Write("回答:")
response.Write("<input type=""text"" name=""answer"&Survey_question(i)&"""><br/><br/>")
if Question_type<>"" then '将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
case else
end select
end if
rs.close
next
response.Write("</ul>")
response.Write("<input type=""hidden"" value="""&Question_type&""" name=""Question_type"">")
response.Write("</form>")
conn.execute("update [Survey] set Survey_hits=Survey_hits+1 where Survey_id="&Survey_id)
else
response.Write("本问卷下暂时没有问题,请添加")
end if
response.Write("</div>")
response.Write("</div>")
'---------------------------------------------------
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -