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

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
  2. <%@ page errorPage="QuestGen_error.jsp" %>
  3. <%@ page import="java.io.*"%>
  4. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  5. </jsp:useBean>
  6. <%@ page import="jinghua.Tools"%>
  7. <script language="javascript">
  8. function CheckForm(f)
  9. {
  10. //获取HTML文本
  11. var strText="";
  12. if (editor.EditMode.checked==true){
  13.   document.myform.Content.value=editor.Composition.document.body.innerText;
  14.   strText=editor.Composition.document.body.innerHTML;
  15.   }
  16.    else{
  17.   document.myform.Content.value=editor.Composition.document.body.innerHTML;
  18.   strText=editor.Composition.document.body.innerText;
  19. }
  20. //var v=document.myform.Content.value=editor.Composition.document.body.innerHTML;
  21. //alert(v);
  22. var imageindex;
  23. var strHtml=document.myform.Content.value;
  24. var arrQuest=new Array();
  25. arrQuest=strHtml.split("@@");
  26. var arrQuestText=new Array();
  27. arrQuestText=strText.split("@@");
  28. for( var i=0;i<arrQuest.length;i++){
  29. imageindex=arrQuest[i].indexOf("v:imagedata");
  30. if(imageindex>=0)
  31. {
  32.      alert("提交的试题中第 "+i+" 道含有从Word导入的图片信息,请仔细检查!n"+"原题目为:n"+arrQuestText[i]);
  33. return false;
  34. }
  35. }
  36. if (f.Answer.value.length < 1) // 没有输入答案
  37. {
  38.     alert("您还没有输入答案!");
  39. return false;
  40. }
  41. if( f.Mark.value.length<1)
  42. {
  43.     alert("您还有输入该试题的分数!");
  44. return false;
  45. }
  46. if(!isNumberString(f.Mark.value,"1234567890."))
  47. {
  48.     alert("嘿!您在分数里填了东西,但怎么不是数字呢?n");
  49.     return false;
  50. }
  51.     if( f.Grade.selectedIndex == 0) {
  52.         alert("请选择年级信息!")
  53.         return false;
  54.     }
  55.     if(f.Subject.selectedIndex==0){
  56.         alert("请选择科目信息!")
  57.         return false;
  58.     }
  59.     if((f.KnowPoint1.selectedIndex==0)&&(f.KnowPoint2.selectedIndex==0)&&(f.KnowPoint3.selectedIndex==0)){
  60.         alert("请选知识点信息!")
  61.         return false;
  62.     }
  63. return true;
  64. }
  65. function isNumberString (InString,RefString)
  66. {
  67. if(InString.length==0) return (false);
  68. for (Count=0; Count < InString.length; Count++)  {
  69. TempChar= InString.substring (Count, Count+1);
  70. if (RefString.indexOf (TempChar, 0)==-1)
  71. return (false);
  72. }
  73. return (true);
  74. }
  75. </script>
  76. <!--年级,科目,知识点三个下拉列表框联动-->
  77. <%
  78. String temp=Tools.sub_know(DBCon.getConnection());
  79. out.print(temp);
  80. temp=Tools.grade_sub(DBCon.getConnection());
  81. out.print(temp);
  82. %>
  83. <script language="JavaScript">
  84. function changegs(locationid){
  85.     document.myform.Subject.length =1;
  86.         document.myform.KnowPoint1.length =1;
  87.         document.myform.KnowPoint2.length =1;
  88.         document.myform.KnowPoint3.length =1;
  89.         var locationid=locationid;
  90.         var i;
  91.         for (i=0;i < gscount; i++){
  92.             if (grade_sub[i][0] == locationid) {
  93.             document.myform.Subject.options[document.myform.Subject.length] = new Option(grade_sub[i][2], grade_sub[i][1]);
  94.             }
  95. }
  96. }
  97. </script>
  98. <script language="JavaScript">
  99. function changesk(locationid){
  100. document.myform.KnowPoint1.length =1;
  101.     document.myform.KnowPoint2.length =1;
  102.     document.myform.KnowPoint3.length =1;
  103. var locationid=locationid;
  104. var i;
  105. for (i=0;i < gskcount; i++){
  106. if (grade_sub_know[i][1] == locationid){
  107. document.myform.KnowPoint1.options[document.myform.KnowPoint1.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  108.             document.myform.KnowPoint2.options[document.myform.KnowPoint2.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  109.             document.myform.KnowPoint3.options[document.myform.KnowPoint3.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  110. }
  111. }
  112. }
  113. </script>
  114. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  115. <html>
  116. <head>
  117. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  118. <link rel="stylesheet" type="text/css" href="../css.css">
  119. <title>试题提交</title>
  120. </head>
  121. <body>
  122. <%!Connection con=null;
  123. String teachID="";
  124. %>
  125. <%
  126. try{
  127.     con=DBCon.getConnection();
  128.  %>
  129. <FORM name="myform" action="updatetest_free.jsp" method=post onSubmit="return CheckForm(this)">
  130.   <input name="teacherID" type="hidden" value="<%=request.getParameter("teacherID")%>">
  131. <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
  132.   <TBODY>
  133.     
  134.     <TR>
  135.         <TD height=45><IMG height=45 src="images/logo.gif"
  136.   width=160></TD>
  137.     </TR>
  138.   </TBODY>
  139. </TABLE>
  140.   
  141.   <table width="100%" height="400" border="0" align="center" cellpadding="0" cellspacing="0">
  142.     <!--DWLayoutTable-->
  143.     <tr>
  144.     <td width="100%" height="535" valign="top">
  145. <table width="100%" height="312" border="1" bordercolor="#d3add1" background="images/lvbgcolor.gif">
  146.           <tr> 
  147.             <td width="34%" height="31" align="left" valign="middle"> 题目类型: 
  148.               <select id=QuestType name=QuestType>
  149.                 <%Tools.showOption("select * from questtype",con,out);%>
  150.               </select> </td>
  151.             <td width="66%" align="left" valign="middle" nowrap>
  152. <table width="100%" border="0">
  153.                 <tr>
  154.                   <td width="10%" height="31" nowrap>名称:</td>
  155.                   <td width="56%"><input name="suit_title" type="text" id="suit_title3" size="40" maxlength="200"></td>
  156.                   <td width="7%">&nbsp;</td>
  157.                   <td width="7%"><input name="Reset_Quest" type="reset" class="s03" id="Reset_Quest4" value="重置"></td>
  158.                   <td width="7%">&nbsp;</td>
  159.                   <td width="13%"><input name="Submit" type="submit" class="s03" value="提交"></td>
  160.                 </tr>
  161.               </table>
  162.               
  163.             </td>
  164.           </tr>
  165.           <tr> 
  166.             <td height="31" align="left" valign="middle"> 年 级: 
  167.               <select id=select10 name=Grade onClick="changegs(document.myform.Grade.options[document.myform.Grade.selectedIndex].value)" size="1">
  168.                 <option value="temp">未选择</option>
  169.                 <%Tools.showGradeOption(con,out);%>
  170.               </select> </td>
  171.             <td rowspan="3" align="center"> <iframe src="../editor/edit.jsp" id='editor' frameborder=0 scrolling=auto width=544 height=321> 
  172.               </iframe> <textarea name="Content" style="display:none"></textarea> 
  173.               &nbsp; <input name="group" type="hidden" id="group" value="suit"> 
  174.               <input name="teacherID" type="hidden" id="teacherID" value="1"></td>
  175.           </tr>
  176.           <tr> 
  177.             <td height="31" align="left" valign="middle"> 科 目: 
  178.               <select id=select8 name=Subject onClick="changesk(document.myform.Subject.options[document.myform.Subject.selectedIndex].value)"
  179. size="1">
  180.                 <option value="temp">未选择</option>
  181.                 <%--Tools.showOption("select * from subject order by id",con,out);--%>
  182.               </select>
  183.             </td>
  184.           </tr>
  185.           <tr> 
  186.             <td height="199" align="center" valign="middle"> 
  187.               <table width="100%" height="60%" border="0">
  188.                 <tr> 
  189.                   <td width="74%" height="28" valign="bottom" nowrap>知识点1:</td>
  190.                 </tr>
  191.                 <tr> 
  192.                   <td height="32" nowrap> <select name=KnowPoint1 id="select6">
  193.                       <option value=-1>----未选择----</option>
  194.                       <%-- Tools.showOption("select * from knowpoint order by id",con,out);--%>
  195.                     </select> </td>
  196.                 </tr>
  197.                 <tr> 
  198.                   <td height="28" valign="bottom" nowrap>知识点2:</td>
  199.                 </tr>
  200.                 <tr> 
  201.                   <td height="39"><select name=KnowPoint2 id="select7">
  202.                       <option value=-1>----未选择----</option>
  203.                       <%-- Tools.showOption("select * from knowpoint order by id",con,out);--%>
  204.                     </select></td>
  205.                 </tr>
  206.                 <tr> 
  207.                   <td height="25" valign="bottom" nowrap>知识点3:</td>
  208.                 </tr>
  209.                 <tr> 
  210.                   <td height="29" nowrap> <select name=KnowPoint3 id="select12">
  211.                       <option value=-1>----未选择----</option>
  212.                       <%-- Tools.showOption("select * from knowpoint order by id",con,out);--%>
  213.                     </select> </td>
  214.                 </tr>
  215.               </table> </td>
  216.           </tr>
  217.         </table></td>
  218.   </tr>
  219. </table>
  220. </form>
  221. </body>
  222. </html>
  223. <%}
  224. catch(Exception e){
  225.     System.out.print(e.toString());
  226. }
  227. finally{
  228.     DBCon.dropConnection();
  229. }
  230. %>