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

教育系统应用

开发平台:

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. <%@ page import="jinghua.Tools"%>
  5. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  6. </jsp:useBean>
  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.  
  37. if (f.Answer.value.length < 1) // 没有输入答案
  38. {
  39.     alert("您还没有输入答案!");
  40. return false;
  41. }
  42. if( f.Mark.value.length<1)
  43. {
  44.     alert("您还有输入该试题的分数!");
  45. return false;
  46. }
  47. if(!isNumberString(f.Mark.value,"1234567890."))
  48. {
  49.     alert("嘿!您在分数里填了东西,但怎么不是数字呢?n");
  50.     return false;
  51. }
  52.     if( f.Grade.selectedIndex == 0) {
  53.         alert("请选择年级信息!")
  54.         return false;
  55.     }
  56.     if(f.Subject.selectedIndex==0){
  57.         alert("请选择科目信息!")
  58.         return false;
  59.     }
  60.     if((f.KnowPoint1.selectedIndex==0)&&(f.KnowPoint2.selectedIndex==0)&&(f.KnowPoint3.selectedIndex==0)){
  61.         alert("请选知识点信息!")
  62.         return false;
  63.     }
  64. return true;
  65. }
  66. function isNumberString (InString,RefString)
  67. {
  68. if(InString.length==0) return (false);
  69. for (Count=0; Count < InString.length; Count++)  {
  70. TempChar= InString.substring (Count, Count+1);
  71. if (RefString.indexOf (TempChar, 0)==-1)
  72. return (false);
  73. }
  74. return (true);
  75. }
  76. </script>
  77. <!--年级,科目,知识点三个下拉列表框联动-->
  78. <%
  79. String temp=Tools.sub_know(DBCon.getConnection());
  80. out.print(temp);
  81. temp=Tools.grade_sub(DBCon.getConnection());
  82. out.print(temp);
  83. %>
  84. <script language="JavaScript">
  85. function changegs(locationid){
  86.     document.myform.Subject.length =1;
  87.         document.myform.KnowPoint1.length =1;
  88.         document.myform.KnowPoint2.length =1;
  89.         document.myform.KnowPoint3.length =1;
  90.         var locationid=locationid;
  91.         var i;
  92.         for (i=0;i < gscount; i++){
  93.             if (grade_sub[i][0] == locationid) {
  94.             document.myform.Subject.options[document.myform.Subject.length] = new Option(grade_sub[i][2], grade_sub[i][1]);
  95.             }
  96. }
  97. }
  98. </script>
  99. <script language="JavaScript">
  100. function changesk(locationid){
  101. document.myform.KnowPoint1.length =1;
  102.     document.myform.KnowPoint2.length =1;
  103.     document.myform.KnowPoint3.length =1;
  104. var locationid=locationid;
  105. var i;
  106. for (i=0;i < gskcount; i++){
  107. if (grade_sub_know[i][1] == locationid){
  108. document.myform.KnowPoint1.options[document.myform.KnowPoint1.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  109.             document.myform.KnowPoint2.options[document.myform.KnowPoint2.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  110.             document.myform.KnowPoint3.options[document.myform.KnowPoint3.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  111. }
  112. }
  113. }
  114. </script>
  115. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  116. <html>
  117. <head>
  118. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  119. <link rel="stylesheet" type="text/css" href="../css.css">
  120. <title>试题提交</title>
  121. </head>
  122. <body>
  123. <%!Connection con=null;
  124. String teachID="";
  125. %>
  126. <%
  127. try{
  128.     con=DBCon.getConnection();
  129.  %>
  130. <FORM name=myform action="updatetest.jsp" method=post onSubmit="return CheckForm(this)">
  131. <input name="teacherID" type="hidden" value="<%=request.getParameter("teacherID")%>">
  132.   <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
  133.     <TBODY>
  134.       
  135.       <TR> 
  136.         <TD height=45><IMG height=45 src="images/logo.gif"
  137.   width=160></TD>
  138.       </TR>
  139.     </TBODY>
  140.   </TABLE>
  141.  
  142.   <table width="100%" height="400" border="0" cellpadding="0" cellspacing="0">
  143.     <!--DWLayoutTable-->
  144.     <tr>
  145.     <td width="100%" height="535" valign="top">
  146. <table width="100%" height="312" border="1" bordercolor="#d3add1" background="images/lvbgcolor.gif">
  147.           <tr> 
  148.             <td width="34%" height="39" align="left" valign="middle"> 题目类型: 
  149.               <select id=QuestType name=QuestType>
  150.                 <%Tools.showOption("select * from questtype",con,out);%>
  151.               </select>
  152.             </td>
  153.             <td width="72%" align="left" valign="middle"><table width="100%" border="0">
  154.                 <tr> 
  155.                   <td width="8%" height="31" nowrap>名称:</td>
  156.                   <td width="54%"><input name="suit_title" type="text" id="suit_title3" size="40" maxlength="200"></td>
  157.                   <td width="7%">&nbsp;</td>
  158.                   <td width="6%"><input name="Reset_Quest2" type="reset" class="s03" id="Reset_Quest4" value="重置"></td>
  159.                   <td width="6%">&nbsp;</td>
  160.                   <td width="19%"><input name="Submit2" type="submit" class="s03" value="提交"></td>
  161.                 </tr>
  162.               </table></td>
  163.           </tr>
  164.           <tr> 
  165.             <td height="31" align="left" valign="middle"> 年 级: 
  166.               <select id=select10 name=Grade onClick="changegs(document.myform.Grade.options[document.myform.Grade.selectedIndex].value)" size="1">
  167.                 <option value="temp">未选择</option>
  168.                 <%Tools.showGradeOption(con,out);%>
  169.               </select>
  170.             </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. %>