日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

试卷考试

發(fā)布時間:2024/9/20 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 试卷考试 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
試卷頁面 1 <body> 2 <form id="form1" runat="server"> 3 <div class="container"> 4 <div class="content"> 5 <% 6 if (Request.QueryString["paperID"] == null) 7 Response.Redirect("~/index/paperList.aspx"); 8 else 9 { 10 string choice = ""; 11 string[] array; 12 int arrayCount = 0; 13 DB db = new DB(); 14 string paperID = Request.QueryString["paperID"]; 15 //string paperID = "試卷20150310153259"; 16 test test = new test(); 17 string qusList = test.getQusList(paperID); 18 List<all_question> questionList = test.getQuestion(qusList); 19 %> 20 <div class="divPaperTitle"><%=paperID %></div> 21 <div class="divBtn"> 22 <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/index/images/btnPaper1.png" OnClick="ImageButton1_Click"/> 23 </div> 24 <div style="clear: left"> 25 <div class="divID">學號:<asp:Label ID="labID" runat="server" Text="xxx" Width="150px"></asp:Label></div> 26 <div class="divName">姓名:<asp:Label ID="labName" runat="server" Text="xxx" ></asp:Label></div> 27 <div class="divTime">考試時長:45分鐘</div> 28 <div class="divTestTime"> 29 <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 30 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> 31 <Triggers> 32 <asp:AsyncPostBackTrigger ControlID="Timer1" /> 33 </Triggers> 34 <ContentTemplate> 35 已用時間:<asp:Label ID="LabelTime" runat="server" ForeColor="Red"></asp:Label> 36 </ContentTemplate> 37 </asp:UpdatePanel> 38 <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"></asp:Timer> 39 </div> 40 </div> 41 42 <div class="Paper"> 43 <div class="divtype">一、判斷題(共20小題,每小題 1 分)</div> 44 <% 45 for (int i = 0; i < 20; i++) 46 { 47 all_question all_question = (all_question)questionList[i]; 48 %> 49 <div class="divquestion"> 50 <%=i+1 %>.<%=all_question.Question%> 51 </div> 52 <div class="divchoice"> 53 <input id="Radio1" type="radio" name="<%=i+1 %>" value="A" /><label for="Radio1"> A:正確</label> 54 <input id="Radio2" type="radio" name="<%=i+1 %>" value="B" /><label for="Radio2"> B:錯誤</label> 55 </div> 56 <%}%> 57 <div class="divtype">二、單選題(共20小題,每小題 2 分)</div> 58 <% 59 for (int j = 20; j < 40; j++) 60 { 61 all_question all_question = (all_question)questionList[j]; 62 choice = all_question.Choice; 63 array = choice.Split(new string[] { "A:", "B:", "C:", "D:", "A:", "B:", "C:", "D:" }, StringSplitOptions.RemoveEmptyEntries); 64 arrayCount = array.Length; 65 %> 66 <div class="divquestion"><%=j+1 %>.<%=all_question.Question %></div> 67 <div class="divchoice"> 68 <input id="Radio3" type="radio" name="<%=j+1 %>" value="A" /><label for="Radio3"> A:<%=array[0] %></label> 69 <br /> 70 <input id="Radio4" type="radio" name="<%=j+1 %>" value="B" /><label for="Radio4"> B:<%=array[1] %></label> 71 <% 72 if (arrayCount == 3) 73 { 74 %> 75 <br /> 76 <input id="Radio5" type="radio" name="<%=j+1 %>" value="C" /><label for="Radio5"> C:<%=array[2] %></label> 77 <% 78 } 79 if (arrayCount == 4) 80 { %> 81 <br /> 82 <input id="Radio6" type="radio" name="<%=j+1 %>" value="C" /><label for="Radio6"> C:<%=array[2] %></label> 83 <br /> 84 <input id="Radio7" type="radio" name="<%=j+1 %>" value="D" /><label for="Radio7"> D:<%=array[3] %></label> 85 <% 86 } 87 %> 88 </div> 89 <% 90 } 91 %> 92 <div class="divtype">三、多選題(共10小題,每小題 4 分)</div> 93 <% 94 for (int m = 40; m < 50; m++) 95 { 96 all_question all_question = (all_question)questionList[m]; 97 choice = all_question.Choice; 98 array = choice.Split(new string[] { "A:", "B:", "C:", "D:", "A:", "B:", "C:", "D:" }, StringSplitOptions.RemoveEmptyEntries); 99 %> 100 <div class="divquestion"><%=m+1 %>.<%=all_question.Question %></div> 101 <div class="divchoice"> 102 <input id="Checkbox1" type="checkbox" name="<%=m+1 %>" value="A" /><label for="Checkbox1"> A:<%=array[0] %></label> 103 <br /> 104 <input id="Checkbox2" type="checkbox" name="<%=m+1 %>" value="B" /><label for="Checkbox2"> B:<%=array[1] %></label> 105 <br /> 106 <input id="Checkbox3" type="checkbox" name="<%=m+1 %>" value="C" /><label for="Checkbox3"> C:<%=array[2] %></label> 107 <br /> 108 <input id="Checkbox4" type="checkbox" name="<%=m+1 %>" value="D" /><label for="Checkbox4"> D:<%=array[3] %></label> 109 </div> 110 <% 111 }%> 112 </div> 113 <% }%> 114 </div> 115 </div> 116 </form> 117 </body> View Code

?

提交試卷并計算成績 1 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) 2 { 3 string paperID = Request.QueryString["paperID"]; 4 //string paperID = "試卷20150310153259"; 5 test test = new test(); 6 string qusList = test.getQusList(paperID); 7 List<all_question> questionList = test.getQuestion(qusList); 8 int totalScore = 0; 9 for (int i = 1; i < 51; i++) 10 { 11 if (!string.IsNullOrEmpty(Request.Form[i.ToString()])) 12 { 13 string selectvalue = Request.Form[i.ToString()]; 14 all_question all_question = (all_question)questionList[i - 1]; 15 if (selectvalue == all_question.Answer) 16 { 17 if (i < 21) 18 totalScore += 1; 19 else if (i < 41) 20 totalScore += 2; 21 else 22 totalScore += 4; 23 24 } 25 //chklist.Add(selectvalue); 26 } 27 } 28 string stuID = labID.Text; 29 string testLength = string.Format("{0:00}:{1:00}", intTmpMin, intTmpSco); 30 string sql = "insert into score(stuID,paperID,score,testLength) values('" + stuID + "','" + paperID + "','" + totalScore + "','" + testLength + "')"; 31 db.sqlEx(sql); 32 Response.Redirect("afterTest.aspx?score=" + totalScore + ""); 33 } View Code

?

超時自動提交 1 protected void Timer1_Tick(object sender, EventArgs e) 2 { 3 4 timesecond = timesecond+1; 5 6 intTmpMin = timesecond / 60; 7 intTmpSco = timesecond % 60; 8 9 LabelTime.Text =intTmpMin.ToString() + "" + intTmpSco.ToString() + ""; 10 if (timesecond>=2700) 11 { 12 Timer1.Enabled = false; 13 ImageButton1_Click(null,null); 14 } 15 } View Code

?

轉(zhuǎn)載于:https://www.cnblogs.com/slyvia230/p/4414425.html

總結(jié)

以上是生活随笔為你收集整理的试卷考试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。