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

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" %>
  2. <%@ page import="java.sql.*" %>
  3. <%@ page import="java.io.*"%>
  4. <%@ page import="jinghua.*"%>
  5. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  6. </jsp:useBean>
  7. <%!
  8. Connection con=null;
  9. PreparedStatement pstmt=null;
  10. ResultSet rs=null;
  11. %>
  12. <%
  13. try{
  14.     con=DBCon.getConnection();
  15. String sql="SELECT   `mn_test`.`id`,  `mn_test`.`name`,  `grade`.`Name` AS `gn` "+
  16. "FROM  `mn_test`  INNER JOIN `grade` ON (`mn_test`.`grade_note` = `grade`.`note`) "+
  17. "ORDER BY  `mn_test`.`grade_note`,  `mn_test`.`id`";
  18.     pstmt=con.prepareStatement(sql);
  19.     rs=pstmt.executeQuery();
  20. %>
  21. <head>
  22. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  23. <title>系统管理 |增加模拟考试</title>
  24. <link rel="stylesheet" type="text/css" href="../css.css">
  25. <style type="text/css">
  26. <!--td { text-decoration: none; font-size: 10pt}
  27. a { text-decoration: none; color: #000000}
  28. a:hover { text-decoration: underline; color: #336699}
  29. .font14 {
  30. font-size: 14px;
  31. line-height: 18px;
  32. }
  33. .l20 {  line-height: 20px; font-size: 13px}
  34. boder2 {  border-color: black #6B90C5 #6B90C5; border-style: solid; border-top-width: 0px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px}
  35. .boder2 {
  36. border-top-width: 0px;
  37. border-right-width: 1px;
  38. border-bottom-width: 1px;
  39. border-left-width: 1px;
  40. border-top-style: solid;
  41. border-right-style: solid;
  42. border-bottom-style: solid;
  43. border-left-style: solid;
  44. border-top-color: black;
  45. border-right-color: #000000;
  46. border-bottom-color: #000000;
  47. border-left-color: #000000;
  48. }
  49. .boder1 {  border: 1px solid #000000}
  50. .font12 {  font-size: 12px; line-height: 18px}
  51. -->
  52. </style>
  53. </head>
  54. <script language="javaScript">
  55. <!--
  56. Now = new Date();
  57. NowDay = Now.getDate();
  58. NowMonth = Now.getMonth();
  59. NowYear = Now.getYear();
  60. if (NowYear < 2000) NowYear += 1900; //for Netscape
  61. //function for returning how many days there are in a month including leap years
  62. function DaysInMonth(WhichMonth, WhichYear)
  63. {
  64.   var DaysInMonth = 31;
  65.   if (WhichMonth == "04" || WhichMonth == "06" || WhichMonth == "09" || WhichMonth == "11") DaysInMonth = 30;
  66.   if (WhichMonth == "02") {
  67.    DaysInMonth = 28;
  68.    if (WhichMonth == "02" && (WhichYear/4) == Math.floor(WhichYear/4)) {
  69.    if ((WhichYear/100) != Math.floor(WhichYear/100)) {
  70.    DaysInMonth = 29;
  71.    }else{
  72.    if ((WhichYear/400) == Math.floor(WhichYear/400)) {
  73.    DaysInMonth = 29;
  74.    }
  75.    }
  76.    }
  77.   }
  78.   return DaysInMonth;
  79. }
  80. //function to change the available days in a months
  81. function ChangeOptionDays(Which)
  82. {
  83.   DaysObject = eval("document.forms['myform']." + Which + "day");
  84.   MonthObject = eval("document.forms['myform']." + Which + "month");
  85.   YearObject = eval("document.forms['myform']." + Which + "year");
  86.   Month = MonthObject[MonthObject.selectedIndex].text;
  87.   Year = YearObject[YearObject.selectedIndex].text;
  88.   DaysForThisSelection = DaysInMonth(Month, Year);
  89.   CurrentDaysInSelection = DaysObject.length;
  90.   if (CurrentDaysInSelection > DaysForThisSelection)
  91.   {
  92.     for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
  93.     {
  94.       DaysObject.options[DaysObject.options.length - 1] = null
  95.     }
  96.   }
  97.   if (DaysForThisSelection > CurrentDaysInSelection)
  98.   {
  99.     for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
  100.     {
  101.       NewOption = new Option(DaysObject.options.length + 1);
  102.       DaysObject.add(NewOption);
  103.     }
  104.   }
  105.     if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
  106. }
  107. function ChangeOptionDays1(Which)
  108. {
  109.   DaysObject = eval("document.forms['myform']." + Which + "day1");
  110.   MonthObject = eval("document.forms['myform']." + Which + "month1");
  111.   YearObject = eval("document.forms['myform']." + Which + "year1");
  112.   Month = MonthObject[MonthObject.selectedIndex].text;
  113.   Year = YearObject[YearObject.selectedIndex].text;
  114.   DaysForThisSelection = DaysInMonth(Month, Year);
  115.   CurrentDaysInSelection = DaysObject.length;
  116.   if (CurrentDaysInSelection > DaysForThisSelection)
  117.   {
  118.     for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
  119.     {
  120.       DaysObject.options[DaysObject.options.length - 1] = null
  121.     }
  122.   }
  123.   if (DaysForThisSelection > CurrentDaysInSelection)
  124.   {
  125.     for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
  126.     {
  127.       NewOption = new Option(DaysObject.options.length + 1);
  128.       DaysObject.add(NewOption);
  129.     }
  130.   }
  131.     if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
  132. }
  133. //function to set options to today
  134. function SetToToday(Which)
  135. {
  136.   DaysObject = eval("document.forms['myform']." + Which + "Day");
  137.   MonthObject = eval("document.forms['myform']." + Which + "Month");
  138.   YearObject = eval("document.forms['myform']." + Which + "Year");
  139.   YearObject[0].selected = true;
  140.   MonthObject[NowMonth].selected = true;
  141.   ChangeOptionDays(Which);
  142.   DaysObject[NowDay-1].selected = true;
  143. }
  144. function checkdata(){
  145.     if( myform.selgrade.selectedIndex == 0) {
  146.         alert("请选择模拟考试的年级信息!")
  147.         return false;
  148.     }
  149.     if(myform.testname.value==""){
  150.         alert("请输入模拟考试的名称!");
  151.         return false;
  152.     }
  153.     return true;
  154. }
  155. function submitit(myform)
  156. {
  157. }
  158. function saveit(myform)
  159. {
  160.   if (confirm("是否保存所有修改?"))
  161.   {
  162.     myform.action="adminnianjisaveedit.asp";
  163.     myform.submit();
  164.   }
  165. }
  166. function delit(myform)
  167. {
  168.   if (confirm("将删除所有选择的模拟考试数据?"))
  169.   {
  170.     myform.action="admin_mn_test_del.jsp";
  171.     myform.submit();
  172.   }
  173. }
  174. //-->
  175. </script>
  176. <body>
  177. <div align="center">
  178.   <center>
  179.     <p align="left">当前位置: 系统管理 &gt; 增加模拟考试</p>
  180.     <table cellspacing="1" style="border-collapse: collapse" bordercolor="#799AE1" width="68%" id="AutoNumber2" border="1">
  181.       <form method="POST" action="admin_mn_test_add.jsp" name="myform" onSubmit="return checkdata()">
  182.       <tr class="trh">
  183.       <td width="100%" height="25"  >
  184.       <p align="center"><b>&nbsp;<font color="#FFFFFF">增加模拟考试</font></b></td>
  185.     </tr>
  186.     <tr class="trh1">
  187.       <td width="100%" height="160"  >
  188.         <p align="center"> </p>
  189.             <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#799AE1" width="99%" height="157">
  190.               <tr>
  191.                 <td width="18%" height="31" bordercolor="#799AE1"> <p align="right">年级:</td>
  192.                 <td height="31" bordercolor="#799AE1"> <select name="selgrade" id="select" size="1">
  193.                     <option selected value="temp">未选择</option>
  194.                     <%Tools.showGradeOption(con,out); %>
  195.                   </select></td>
  196.               </tr>
  197.               <tr>
  198.                 <td width="18%" height="31" bordercolor="#799AE1"> <p align="right">考试名称:</td>
  199.                 <td height="31" bordercolor="#799AE1"> <p align="left">
  200.                     <input name="testname" type="text" id="testname" size="40" maxlength="100">
  201.                 </td>
  202.               </tr>
  203.               <tr>
  204.                 <td width="18%" height="31" bordercolor="#799AE1"> <p align="right">考试开始时间:</td>
  205.                 <td height="31" bordercolor="#799AE1"> <select name="dateyear"  onChange=ChangeOptionDays('date') class="boder2">
  206.                     <option value=2003>2003</option>
  207.                     <option value=2004>2004</option>
  208.                     <option value=2005>2005</option>
  209.                     <option value=2006>2006</option>
  210.                     <option value=2007>2007</option>
  211.                     <option value=2008>2008</option>
  212.                     <option value=2009>2009</option>
  213.                     
  214.                   </select>
  215.                   年
  216.                   <select name="datemonth" onChange=ChangeOptionDays('date')  >
  217.                     <option value="1">01</option>
  218.                     <option value="2">02</option>
  219.                     <option value="3">03</option>
  220.                     <option value="4">04</option>
  221.                     <option value="5">05</option>
  222.                     <option value="6">06</option>
  223.                     <option value="7">07</option>
  224.                     <option value="8">08</option>
  225.                     <option value="9">09</option>
  226.                     <option value="10">10</option>
  227.                     <option value="11">11</option>
  228.                     <option value="12">12</option>
  229.                   </select>
  230.                   月
  231.                   <select name="dateday"  onChange=ChangeOptionDays('date') class="boder2">
  232.                     <option value="1">01</option>
  233.                     <option value="2">02</option>
  234.                     <option value="3">03</option>
  235.                     <option value="4">04</option>
  236.                     <option value="5">05</option>
  237.                     <option value="6">06</option>
  238.                     <option value="7">07</option>
  239.                     <option value="8">08</option>
  240.                     <option value="9">09</option>
  241.                     <option value="10">10</option>
  242.                     <option value="11">11</option>
  243.                     <option value="12">12</option>
  244.                     <option value="13">13</option>
  245.                     <option value="14">14</option>
  246.                     <option value="15">15</option>
  247.                     <option value="16">16</option>
  248.                     <option value="17">17</option>
  249.                     <option value="18">18</option>
  250.                     <option value="19">19</option>
  251.                     <option value="20">20</option>
  252.                     <option value="21">21</option>
  253.                     <option value="22">22</option>
  254.                     <option value="23">23</option>
  255.                     <option value="24">24</option>
  256.                     <option value="25">25</option>
  257.                     <option value="26">26</option>
  258.                     <option value="27">27</option>
  259.                     <option value="28">28</option>
  260.                     <option value="29">29</option>
  261.                     <option value="30">30</option>
  262.                     <option value="31">31</option>
  263.                   </select>
  264.                   日 </td>
  265.               </tr>
  266.               <tr>
  267.                 <td width="18%" height="32" bordercolor="#799AE1"><div align="right">
  268.                     <p>考试结束时间:</p>
  269.                   </div></td>
  270.                 <td height="32" bordercolor="#799AE1"> <select name="dateyear1" class="boder2" id="dateyear1"  onChange=ChangeOptionDays1('date')>
  271.                     <option value=2003>2003</option>
  272.                     <option value=2004>2004</option>
  273.                     <option value=2005>2005</option>
  274.                     <option value=2006>2006</option>
  275.                     <option value=2007>2007</option>
  276.                     <option value=2008>2008</option>
  277.                     <option value=2009>2009</option>
  278.                     
  279.                   </select>
  280.                   年
  281.                   <select name="datemonth1" id="datemonth1" onChange=ChangeOptionDays1('date')  >
  282.                     <option value="1">01</option>
  283.                     <option value="2">02</option>
  284.                     <option value="3">03</option>
  285.                     <option value="4">04</option>
  286.                     <option value="5">05</option>
  287.                     <option value="6">06</option>
  288.                     <option value="7">07</option>
  289.                     <option value="8">08</option>
  290.                     <option value="9">09</option>
  291.                     <option value="10">10</option>
  292.                     <option value="11">11</option>
  293.                     <option value="12">12</option>
  294.                   </select>
  295.                   月
  296.                   <select name="dateday1" class="boder2" id="dateday1"  onChange=ChangeOptionDays1('date')>
  297.                     <option value="1">01</option>
  298.                     <option value="2">02</option>
  299.                     <option value="3">03</option>
  300.                     <option value="4">04</option>
  301.                     <option value="5">05</option>
  302.                     <option value="6">06</option>
  303.                     <option value="7">07</option>
  304.                     <option value="8">08</option>
  305.                     <option value="9">09</option>
  306.                     <option value="10">10</option>
  307.                     <option value="11">11</option>
  308.                     <option value="12">12</option>
  309.                     <option value="13">13</option>
  310.                     <option value="14">14</option>
  311.                     <option value="15">15</option>
  312.                     <option value="16">16</option>
  313.                     <option value="17">17</option>
  314.                     <option value="18">18</option>
  315.                     <option value="19">19</option>
  316.                     <option value="20">20</option>
  317.                     <option value="21">21</option>
  318.                     <option value="22">22</option>
  319.                     <option value="23">23</option>
  320.                     <option value="24">24</option>
  321.                     <option value="25">25</option>
  322.                     <option value="26">26</option>
  323.                     <option value="27">27</option>
  324.                     <option value="28">28</option>
  325.                     <option value="29">29</option>
  326.                     <option value="30">30</option>
  327.                     <option value="31">31</option>
  328.                   </select>
  329.                   日 </td>
  330.               </tr>
  331.             </table>
  332.         <p align="center"> </p>
  333.       </td>
  334.     </tr>
  335.     <tr>
  336.           <td width="100%" height="25" bgcolor="#FFFDE8" bordercolor="#799AE1"> <p align="center">
  337.               <input type="submit" value="增 加" name="B1" class="s02">
  338.               <span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp; </span>
  339.               <input type="button" value="关闭窗口" name="B2" onclick="self.close()" class="s02">
  340.           </td>
  341.  </tr></form>
  342.   </table>
  343.     <p>&nbsp;</p>
  344.     <form name="admin_mn_test_del" method="get" onSubmit="return submitit(this)">
  345.       <table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#799AE1" width="532" id="AutoNumber1">
  346.         <tr    class="trh"> 
  347.           <td width="27" align="center" bgcolor="#E1E1E1" height="20"><input type=checkbox name=del_all1 value=1 onclick=FanAll(adminbanji)></td>
  348.           <td width="36" align="center" bgcolor="#E1E1E1"><font color="#FFFFFF"><b>序号</b></font></td>
  349.           <td align="center" bgcolor="#E1E1E1" width="118"> <font color="#FFFFFF"> 
  350.             <b>年级</b> </font></td>
  351.           <td align="center" bgcolor="#E1E1E1" width="322"> <font color="#FFFFFF">考试名称</font></td>
  352.         </tr>
  353.         <%
  354.         int i=1;
  355.         while(rs.next()){%>
  356.         <tr   class="trh1"> 
  357.           <td align="center"   width="27"> <input type="checkbox" name="id" value="<%=rs.getInt("id")%>"></td>
  358.           <td align="center" width="36"><%=i%> </td>
  359.           <td width="118" align="center"><%=""+rs.getString("gn")%>&nbsp; </td>
  360.           <td width="322" align="center"><div align="left"><%=""+rs.getString("name")%>&nbsp;</div></td>
  361.         </tr>
  362.         <%
  363.       i++;
  364.       }
  365.       rs.close();
  366.       pstmt.close();
  367.       %>
  368.         <caption>
  369.         <p align="right"> 
  370.           <input type="submit" value="删除所选项" name="del" onclick="delit(admin_mn_test_del)" class="s02">
  371.         </p>
  372.         </caption>
  373.       </table>
  374.     </form>
  375.     <p>&nbsp;</p>
  376.   </center>
  377. </div>
  378. </body>
  379. </html>
  380. <%
  381. }
  382. catch(Exception e){
  383.     out.print(e.toString());
  384. }
  385. finally{
  386.     DBCon.dropConnection();
  387. }
  388. %>