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

📄 viewsurveyresultpage.asp

📁 implementation of survey
💻 ASP
📖 第 1 页 / 共 3 页
字号:
		while not rcs.eof 		
				docFile.WriteLine "    *" & rcs(subAnserTitle)
				rcs.moveNext
		wend

		set rcs = nothing
		set con = nothing		
		set docFile=nothing
		set creator=nothing
end function


function getQuestionType(tableName)
		dim xmlPath, questionDom, questionsNode, tablesNum, questionId, typeString

		xmlsPath = Server.MapPath("../xmls")		
		set questionDom = Server.CreateObject("Microsoft.XMLDOM")
		questionDom.async = false
		questionDom.load(xmlsPath & "/surveyInfo.xml")
		set questionsNode = questionDom.getElementsByTagName("question")
		tablesNum = questionsNode.length	

		for i = 0 to tablesNum-1 step 1
			questionId = questionsNode.item(i).getAttribute("id")
			if questionId = tableName then
				typeString = questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text
			end if
		next		
		set questionsNode = nothing
		set questionDom = nothing
'		response.Write("function getQuestionType works well   result: " & typeString)
		getQuestionType = typeString
end function

function persentRate(terminator, determinator)
		dim temp
		temp = 0.00
		if (not terminator = 0) and (not determinator = 0) then
			temp =FormatNumber(terminator*100 / determinator, 2, , ,0)
		end if
		persentRate = temp
end function

function analyze()
		dim arrayId, arrayValue, xmlsPath, questionsNode, tablesNum, answersNode, answersNum, temp
		dim con, rcs, sql, children, num, i, k, nodeId, questionDom, answerDom, questionId, answerId
		dim totalVoters, databasePath,  accessDB, surveyTitle
		
		databasePath = Server.MapPath("../database")
		accessDB = databasePath & "/surveyData.mdb"
		set con = server.createObject("ADODB.Connection")
		set rcs = server.createObject("ADODB.Recordset")
		set answersSet = server.createObject("ADODB.Recordset")
		con.provider = "Microsoft.Jet.OLEDB.4.0"
		con.Open(accessDB)
		
		xmlsPath = Server.MapPath("../xmls")
		
		set questionDom = Server.CreateObject("Microsoft.XMLDOM")
		questionDom.async = false
		questionDom.load(xmlsPath & "/surveyInfo.xml")
		set questionsNode = questionDom.getElementsByTagName("question")
		tablesNum = questionsNode.length
		
		set answerDom = Server.CreateObject("Microsoft.XMLDOM")
		answerDom.async = false
		answerDom.load(xmlsPath & "/answerSheetModel.xml")	
		set answersNode = answerDom.getElementsByTagName("answer")
		answersNum = answersNode.length		
		surveyTitle =  questionDom.getElementsByTagName("surveyName_E").item(0).text
		tempCode = "<h1 align ='center' style='color:#876543;margin-top:80px; margin-bottom:100px;'>"&surveyTitle&" Survey Result Analysis</h1>"
		htmlCode = htmlCode  &  tempCode
		response.Write(tempCode)
		for i = 0 to tablesNum step 1
				
				questionId = questionsNode.item(i).getAttribute("id")
				questionTitle = questionsNode.item(i).childNodes.item(1).childNodes.item(0).Text
				
				dim isText, iftext, isGrid
				isText = inStr(1,LCase(questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text), "text",1)
				isGrid = inStr(1,LCase(questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text), "grid",1)
				isRadio = inStr(1,LCase(questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text), "radio",1)
				isRank = inStr(1,LCase(questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text), "rank",1)
				isCheckbox = inStr(1,LCase(questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text), "check", 1)
				isDropdown = inStr(1,LCase(questionsNode.item(i).childNodes.item(3).childNodes.item(0).Text), "drop-down list",1)

				if   ( isRadio <> 0 or isCheckbox <> 0 )and isGrid = 0 then
						sql = "select * from " & questionId 
						rcs.open sql, con, 1, 1
						totalVoters = 	rcs.RecordCount
						rcs.close	
						thisReplies = getQuestionAnsweredTimes(questionId)
						chooseRate = persentRate(thisReplies, totalVoters)
						tempCode = "<table width='900' align='center' style='border:solid; border-color:#CCCCCC;                                                                                      border-width:thin; margin-top:20;'>"
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)	
						tempCode = "<tr><th colSpan='3' align='left' style='background-color:#9CCEFF;'>"                                   & questionTitle & "</th></tr>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode
				        tempCode = "<tr style='background-color=#ACCEFF;'><td >Totally Survey Replies:</td>                                                   <td id ='"&questionId&"' align='center' colSpan=2>" & totalVoters & "</td></tr>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode
				        tempCode = "<tr style='background-color=#BCCEFF;'><td >Replies Times For This Question:</td>                                              <td id ='" & questionId &"RepliedTimes' align='center'>" & thisReplies & "</td>                                              <td id ='" & questionId &"RepliedRate' align='center'>" & chooseRate & " %</td></tr>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode						
						for k = 0 to answersNum-1 step 1	
								answerId = 	answersNode.item(k).getAttribute("id")
								if inStr(answerId, "answer") <> 0 then
									temp = left(answerId, inStr(answerId, "answer")-1)
								else
									temp = answerId
								end if
								if trim(LCase(temp)) = trim(LCase(questionId)) then									
									tempCode = "<tr style='background-color=#B7CDCA;'><td id='"& answerId &"' >"                                                        & getAnswerTitleFromAnswerMark(answerId) & "</td>"
									htmlCode = htmlCode  &  tempCode
									response.Write(tempCode)
									answerReplies = getCheckedCount(questionId, answerId)
									answerRate = persentRate(answerReplies, thisReplies)
									tempCode = "<td id='"&answerId&"RepliedTimes' align='center'>" & answerReplies & "</td>                                           <td id='"&answerId&"RepliedRate' align='center' width=100>" & answerRate & " %</td></tr>"
									response.Write(tempCode)
									htmlCode = htmlCode  &  tempCode
								end if
						next
						tempCode = "</table>"
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)
				end if	
				
				if   ( isDropdown <> 0 )and isGrid = 0 then
						sql = "select * from " & questionId 
						rcs.open sql, con, 1, 1
						totalVoters = 	rcs.RecordCount
						rcs.close	
						thisReplies = getQuestionAnsweredTimes(questionId)
						chooseRate = persentRate(thisReplies, totalVoters)
						tempCode = "<table width='900' align='center' style='border:solid; border-color:#CCCCCC;                                                                                      border-width:thin; margin-top:20;'>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode
						tempCode = "<tr><th colSpan='3' align='left' style='background-color:#9CCEFF;'>"                                   & questionTitle & "</th></tr>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode
				        tempCode = "<tr style='background-color=#ACCEFF;'><td >Totally Survey Replies:</td>                                             <td id ='"&questionId&"' align='center' colSpan=2>" & totalVoters & "</td></tr>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode
				        tempCode = "<tr style='background-color=#BCCEFF;'><td >Replies Times For This Question:</td>                                              <td id ='" & questionId &"RepliedTimes' align='center'>" & thisReplies & "</td>                                              <td id ='" & questionId &"RepliedRate' align='center'>" & chooseRate & " %</td></tr>"
						response.Write(tempCode)
						htmlCode = htmlCode  &  tempCode
						
						optionsNum = questionsNode.item(i).childNodes.item(4).childNodes.length	
						for k = 1 to optionsNum-1 step 1
								optionNodes = questionsNode.item(i).childNodes.item(4).childNodes.item(k).childNodes.item(0).Text
								answerId = questionsNode.item(i).childNodes.item(4).childNodes.item(k).getAttribute("id")
								selectedNum = getSelectedCount(questionId, k)
								answerRate = persentRate(selectedNum, thisReplies)
								tempCode = "<tr style='background-color=#B7CDCA;'><td >" & optionNodes & "</td>"
								htmlCode = htmlCode  &  tempCode
								response.Write(tempCode)
								
								tempCode = "<td id='"&answerId&"RepliedTimes' align='center'>" & selectedNum & "</td>                                          <td id='"&answerId&"RepliedRate' align=' center' width=100>" & answerRate & " %</td></tr>"
								
								htmlCode = htmlCode  &  tempCode
								response.Write(tempCode)
						next	 		
						tempCode = "</table>"
						htmlCode = htmlCode & tempCode
						response.Write(tempCode)
				end if		


				if   ( isCheckbox <> 0 )and isGrid <> 0 then
						sql = "select * from " & questionId 
						rcs.open sql, con, 1, 1
						totalVoters = 	rcs.RecordCount
						rcs.close	
						thisReplies = getQuestionAnsweredTimes(questionId)
						chooseRate = persentRate(thisReplies, totalVoters)
						tempCode = "<table width='900' align='center' style='border:solid; border-color:#CCCCCC;                                                                                      border-width:thin; margin-top:20;'>"
						htmlCode = htmlCode & tempCode
						response.Write(tempCode)
						tempCode = "<tr><th colSpan='8' align='left' style='background-color:#9CCEFF;'>"                                   & questionTitle & "</th></tr>"
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)
				        tempCode = "<tr style='background-color=#ACCEFF;'><td colSpan=6>Totally Survey Replies:</td>                                                <td id ='"&questionId&"' align='center' colSpan=2>" & totalVoters & "</td></tr>"
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)
				        tempCode = "<tr style='background-color=#BCCEFF;'> <td colSpan=6>Replies Times For This Question:</td>                                              <td id ='" & questionId &"RepliedTimes' align='center'>" & thisReplies & "</td>                                              <td id ='" & questionId &"RepliedRate' align='center'>" & chooseRate & " %</td></tr>"
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)
						set ranksSet = questionsNode.item(i).childNodes.item(4).childNodes.item(0).childNodes.item(0).childNodes
						ranksNum = ranksSet.length	
						tempCode = "<tr style='background-color=#B7CDCA;'><td></td><td>replying rate</td>"
						htmlCode = htmlCode  &  tempCode
						response.Write(htmlCode)	
						nullColsNum = 0				
						for m = 0 to ranksNum-1 step 1
								rankTitle = ranksSet.item(m).Text
								if not len(rankTitle) = 0 then
									tempCode = "<td align='center'>" & trim(rankTitle) & "</td>" 
									htmlCode = htmlCode  &  tempCode
									response.Write(tempCode)
								else
										nullColsNum = nullColsNum +1
		                        end if
						next
						if nullColsNum > 0 then
							tempCode = "<td colSpan = " & nullColsNum & "></td>" 
							htmlCode = htmlCode  &  tempCode
							response.Write(tempCode)
						end if
						tempCode = "</tr>"
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)
						set answerSet = questionsNode.item(i).childNodes.item(4).childNodes
						gridAnswersNum = answerSet.length
						for m = 1 to gridAnswersNum-1 step 1
								gridAnswerId = answerSet.item(m).getAttribute("id")
								answerTopic = answerSet.item(m).childNodes.item(0).Text
								tempCode = "<tr style='background-color=#B7CDCA;'><td>" & answerTopic & "</td>" 
								htmlCode = htmlCode  &  tempCode
								response.Write(tempCode)
								subQuestionReplyTimes = getSubQuestionReplyTimes( questionId, gridAnswerId )
								tempCode="<td id='" & gridAnswerId&"'>"& persentRate(subQuestionReplyTimes, thisReplies) &" %</td>"
								htmlCode = htmlCode  &  tempCode
								response.Write(tempCode)
								for k = 0 to answersNum-1 step 1
										answerId = 	answersNode.item(k).getAttribute("id")
										if inStr(answerId, "rank") <> 0 then
											temp = left(answerId, inStr(answerId, "rank")-1)
											if trim(LCase(gridAnswerId))=trim(LCase(temp)) then									
													answerReplies = getCheckedCount(questionId, answerId)
													answerRate = persentRate(answerReplies, thisReplies)
													tempCode="<td id='"&answerId&"' align='center' width=100>"&answerRate&" %</td>"
													htmlCode = htmlCode  &  tempCode
													response.Write(tempCode)
											end if
										end if
								next	
								if not nullColsNum = 0 then
										tempCode = "<td colSpan=" & nullColsNum & " ></td>"
										htmlCode = htmlCode  &  tempCode
										response.Write(tempCode)
								end if
								tempCode = "</tr>"	
								htmlCode = htmlCode  &  tempCode
								response.Write(tempCode)			
						next
						if not nullColsNum = 0 then
							tempCode = "<td colSpan=" & nullColsNum & " ></td>"
							htmlCode = htmlCode  &  tempCode
							response.Write(tempCode)							
						end if
						tempCode = "</tr></table>"	
						htmlCode = htmlCode  &  tempCode
						response.Write(tempCode)				
				end if	

				if   ( isRadio <> 0 or isRank <> 0)and isGrid <> 0 then
						sql = "select * from " & questionId 

⌨️ 快捷键说明

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