err_test_type.jsp
上传用户:nbluoke
上传日期:2013-08-09
资源大小:4851k
文件大小:7k
源码类别:

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <%!
  3. String sqlCon;
  4. String sql;
  5. String selectID;
  6. boolean debug=false;
  7. String[] arrID;
  8. String[] arrSelect;
  9. %>
  10. <%
  11. String errorpad_grade=request.getParameter("Grade");
  12. String errorpad_sub=request.getParameter("Subject");
  13. String errorpad_knowpoint=request.getParameter("KnowPoint");
  14. String errorpad_testtype=request.getParameter("testtype");
  15. String errorpad_errorcount=request.getParameter("errorcount");
  16. if(debug){
  17.     out.print("<br>grade="+errorpad_grade+
  18.     "<br>sub="+errorpad_sub+
  19.     "<br>knowpoint="+errorpad_knowpoint+
  20.     "<br>testtype="+errorpad_testtype+
  21.     "<br>errorcunt="+errorpad_errorcount);
  22. }
  23. if(errorpad_grade!=null)
  24. {
  25.     session.setAttribute("errorpad_grade",errorpad_grade);
  26. }
  27. else
  28. {
  29.     errorpad_grade=(String)session.getAttribute("errorpad_grade");
  30. }
  31. if(errorpad_sub!=null)
  32. {
  33.     session.setAttribute("errorpad_sub",errorpad_sub);
  34. }else
  35. {
  36.     errorpad_sub=(String)session.getAttribute("errorpad_sub");
  37. }
  38. if(errorpad_knowpoint!=null)
  39. {
  40.     session.setAttribute("errorpad_knowpoint",errorpad_knowpoint);
  41. }
  42. else
  43. {
  44.     errorpad_knowpoint=(String)session.getAttribute("errorpad_knowpoint");
  45. }
  46. if(errorpad_testtype!=null)
  47. {
  48.     session.setAttribute("errorpad_testtype",errorpad_testtype);
  49. }
  50. else
  51. {
  52.     errorpad_testtype=(String)session.getAttribute("errorpad_testtype");
  53. }
  54. if(errorpad_errorcount!=null)
  55. {
  56.     session.setAttribute("errorpad_errorcount",errorpad_errorcount);
  57. }
  58. else
  59. {
  60.     errorpad_errorcount=(String)session.getAttribute("errorpad_errorcount");
  61. }
  62. int idnum=0;
  63. try{
  64. arrID=(String[])session.getAttribute("arrID");
  65. arrSelect=(String[])session.getAttribute("arrSelect");
  66. //处理旧页面
  67. String order_chk=request.getParameter("order_chk");
  68. if(debug){
  69. out.print("<br>order_chk="+order_chk);
  70. out.print("<br>arrID="+arrID.toString());
  71. out.print("<br>arrSelect="+arrSelect.toString());
  72. }
  73. if(order_chk!=null && !order_chk.equals("temp")){
  74. //145:0#146:1#
  75. String arrOrder_Sin[]=null;
  76. String arrOrder_chk[]=order_chk.split("#");
  77. for(int i=0;i<arrOrder_chk.length;i++){
  78. if(debug)
  79. out.print("<br> arrorder_chk["+i+"]="+arrOrder_chk[i]);
  80. arrOrder_Sin=arrOrder_chk[i].split(":");
  81. arrSelect[Integer.parseInt(arrOrder_Sin[0])-1]=arrOrder_Sin[1];
  82. }
  83. }
  84. //取回选择试题的ID
  85. selectID="";
  86. StringBuffer sb=new StringBuffer();
  87. idnum=0;
  88. for(int i=0;i<arrID.length;i++){
  89. if(arrSelect[i].equals("1")){
  90. sb.append(arrID[i]+",");
  91. idnum++;
  92. }
  93. }
  94. selectID=sb.toString().substring(0,sb.length()-1);
  95. if(debug){
  96. out.print("<br>selectID="+selectID);
  97. }
  98. session.setAttribute("errorpad_selectID",selectID);
  99. if(debug){
  100.     out.println("<br>selectID="+selectID);
  101. }
  102. }
  103. catch(Exception e){
  104.     out.print("<br>error "+e.toString());
  105. }
  106. %>
  107. <script language="javascript">
  108. function CheckForm(f)
  109. {
  110. if( f.testnumber.value.length<1)
  111. {
  112.     alert("您还有输入测验的试题数!");
  113. return false;
  114. }
  115. if(!isNumberString(f.testnumber.value,"1234567890."))
  116. {
  117.     alert("嘿!您在试题数里填了东西,但怎么不是数字呢?n");
  118.     return false;
  119. }else if(f.testnumber.value<5 && (!f.testtype[1].checked)){
  120.             alert("您在试题数里填写大于4的数字!");
  121.             return false;
  122. }
  123.    if( !(f.testtype[0].checked || f.testtype[1].checked||f.testtype[2].checked) ) {
  124. alert("您还没有选择测试范围!!")
  125. return false;
  126. }
  127.     if(f.testtype[1].checked){
  128.         if(f.selectcount.value==0){
  129.             alert("您还没有在错题本中选择错题!!");
  130.             return false;
  131.         }
  132.     }
  133. if( !(f.testorder[0].checked || f.testorder[1].checked||f.testorder[2].checked) ) {
  134. alert("您还没有选择测试顺序!")
  135. return false;
  136. }
  137. return true;
  138. }
  139. function isNumberString (InString,RefString)
  140. {
  141. if(InString.length==0) return (false);
  142. for (Count=0; Count < InString.length; Count++)  {
  143. TempChar= InString.substring (Count, Count+1);
  144. if (RefString.indexOf (TempChar, 0)==-1)
  145. return (false);
  146. }
  147. return (true);
  148. }
  149. </script>
  150. <html>
  151. <head>
  152. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  153. <title>错题本测验-选择测验类型</title>
  154. </head>
  155. <body bgcolor="#C8D6F0">
  156. <div align="center">
  157.   <form action="err_test_paper.jsp" method="post" name="testtype" target="_blank" onSubmit="return CheckForm(this)">
  158.     <table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
  159.       <tr>
  160.         <td height="42" colspan="4">
  161.           <div align="center"><font color="#000000">精化学堂错题本</font>-请选择测验内容</div></td>
  162.       </tr>
  163.       <tr>
  164.         <td height="30" colspan="2" nowrap><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 测试范围:</font></td>
  165.         <td colspan="2" nowrap><font color="#000000">测试顺序:</font></td>
  166.       </tr>
  167.       <tr>
  168.         <td width="13%"><div align="right">
  169.             <input type="radio" name="testtype" value="1">
  170.           </div></td>
  171.         <td width="46%" nowrap>浏览的错题</td>
  172.         <td width="3%"><input type="radio" name="testorder" value="1"></td>
  173.         <td width="38%" nowrap>随机顺序</td>
  174.       </tr>
  175.       <tr>
  176.         <td> <div align="right">
  177.             <input type="radio" name="testtype" value="2" onclick="document.testtype.testnumber.value=document.testtype.selectcount.value">
  178.           </div></td>
  179.         <td nowrap>浏览列表中选中的错题</td>
  180.         <td><input type="radio" name="testorder" value="2"></td>
  181.         <td nowrap>从难到易</td>
  182.       </tr>
  183.       <tr>
  184.         <td height="23"> <div align="right">
  185.             <input type="radio" name="testtype" value="3">
  186.           </div></td>
  187.         <td nowrap>错题本中的所有错题</td>
  188.         <td><input type="radio" name="testorder" value="3"></td>
  189.         <td nowrap>从易到难</td>
  190.       </tr>
  191.       <tr>
  192.         <td height="43" colspan="4" nowrap><div align="center"><font color="#000000">试题数:
  193.             <input name="testnumber" type="text" id="testnumber2" value="5" size="10">
  194.             </font></div></td>
  195.       </tr>
  196.       <tr>
  197.         <td colspan="4" nowrap>
  198. <div align="center">
  199.             <input name="testbegin" type="submit" id="testbegin3" value="开 始" onClick="window.close()">
  200.           </div></td>
  201.       </tr>
  202.     </table>
  203.     <p align="left">&nbsp; </p>
  204.     <p>&nbsp; </p>
  205.     <p>
  206.       <input  name="sqlcon" id="sqlcon3" type="hidden" value="<%=sqlCon%>" >
  207.       <input  name="selectcount" id="sql3" type="hidden" value="<%=idnum%>" >
  208.     </p>
  209.     <p>&nbsp;</p>
  210.     <p>&nbsp;</p>
  211.   </form>
  212.   <p align="left">&nbsp;</p>
  213.   <p align="left"><font color="#000000"> </font></p>
  214.   <p align="left">&nbsp; </p>
  215. </div>
  216. </body>
  217. </html>