⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testaddmany.jsp

📁 培训考试系统代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312"%>

<%@ include file="/agt/public/jsp/top.jsp" %>
<%

String testType = request.getParameter("testType");

int   testTypeInt = 0;

if(testType != null)

{

   testTypeInt = Integer.parseInt(testType.trim());

}

%>
<%if("1".equalsIgnoreCase(request.getParameter("success")))
  {
%>
     <font color="#000000">已成功录入上一题,请录入下一题: </font>

<%}%>
<form name="addtestform" method="POST" enctype="multipart/form-data" action="/servlet/com.huawei.icd30.agt.testman.TestAddManServlet">

              <table width="539" border="0" cellpadding="3" cellspacing="1" class="table-cs1">


    <tr>

      <td width="15%" align="center" class="td-cs1">试题题型</td>

      <td   width="85%" class="td-cs1">

        <select  name="testType" size="1" class="input3" onchange="changeType(this.value)">

          <% SysResultSet typeRs  =  TestGetInfo.getTestTypeRs();



        if(typeRs != null)

        {  for(int i=0;typeRs.setRecord(i)&&i<typeRs.getMetaData().getRecordCount();i++)

           {

      %>

       <option value="<%=typeRs.getString(0)%>" <%if(testTypeInt == typeRs.getInt(0)){%> selected <%}%>><%=typeRs.getString(1)%></option>

     <%     }

         }

     %>

     </select>

      </td>

  </tr>



  <input type="hidden" name="content" value="">

  <input type="hidden" name="opeType" value="<%=OperatorFlagCode.TEST_ADD%>">

  <input type="hidden" name="optionRs" value="">

  <input type="hidden" name="option" value="">

  <input type="hidden" name="explain" value="">

  <input type="hidden" name="degree" value="">

  <input type="hidden" name="classId" value="">

  <input type="hidden" name="testMeans" value="">

  <input type="hidden" name="useLevel" value="">

  <input type="hidden" name="referenceTime" value="">
  
  <input type="hidden" name="byClass" value="1">



    <tr align="center">

      <td  colspan="2" class="td-cs1">试题内容*</td>

  </tr>

    <tr>

      <td colspan="2" class="remark">

        <%@ include file="../public/editor/editor.html" %>

      </td>

  </tr>



  </table>



              <table width="539" border="0" cellpadding="3" cellspacing="1" class="table-cs1" id="optionTable">


    <tr>



                  <td  width="15%" align="center" class="td-cs1">试题选项*</td>



                  <td width="85%" class="td-cs2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="61%"><input type="checkbox" name="optionRsDis">
                          <input name="optionDis" type="text" class="input2" size="43" maxlength="450"></td>
                        <td width="39%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="35%"><input name="add3" type="image" onClick="addOption();return false;" src="/agt/public/images/add3.gif" width="48" height="25" border="0" onMouseOver="this.src='/agt/public/images/'+ this.name + '_2.gif';" onMouseOut="this.src='/agt/public/images/'+ this.name + '.gif'"></td>
                              <td width="65%"><input name="del3" type="image" onClick="delOption();return false;" src="/agt/public/images/del3.gif" width="48" height="25" border="0" onMouseOver="this.src='/agt/public/images/'+ this.name + '_2.gif';" onMouseOut="this.src='/agt/public/images/'+ this.name + '.gif'"></td>
                            </tr>
                          </table> </td>
                      </tr>
                    </table></td>

	  </tr>



	  <tr>



      <td align="center" class="td-cs1">&nbsp; </td>



      <td class="td-cs2">

<input type="checkbox" name="optionRsDis">

	     <input name="optionDis" type="text" class="input2" size="43" maxlength="450"></td>

	  </tr>



	  <tr>



      <td align="center" class="td-cs1">&nbsp; </td>



      <td class="td-cs2">

<input type="checkbox" name="optionRsDis">

	     <input name="optionDis" type="text" class="input2" size="43" maxlength="450">

	     <input type="checkbox" name="optionCB" id="optionCB"> </td>

	  </tr>



	  <tr>



      <td align="center" class="td-cs1">&nbsp; </td>



      <td colspan="3" class="td-cs2">

<input type="checkbox" name="optionRsDis">

	     <input name="optionDis" type="text" class="input2" size="43" maxlength="450">

	     <input type="checkbox" name="optionCB" id="optionCB"></td>

	 </tr>

  </table>



              <table width="539" border="0" cellpadding="3" cellspacing="1" class="table-cs1">


    <tr>

      <td align="center" class="td-cs1">简要说明</td>

      <td colspan="3" class="td-cs2"> <textarea name="explainDis" cols="55" rows="5" class="remark"></textarea></td>

    </tr>

    <tr>

      <td width="15%"  align="center" class="td-cs1">试题难度</td>

      <td width="35%" class="td-cs2"> <select name="degreeDis" class="input3">

          <% SysResultSet degreeRs  =  TestGetInfo.getDegreeRs();



        if(degreeRs != null)

        {  for(int i=0;degreeRs.setRecord(i)&&i<degreeRs.getMetaData().getRecordCount();i++)

           {

      %>

          <option value="<%=degreeRs.getString(0)%>"><%=degreeRs.getString(1)%></option>

          <%     }

         }

     %>

        </select> </td>

      <td width="15%" align="center" class="td-cs1">所属类别*</td>

                  <td width="35%" class="td-cs2">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="56%"><input name="className" type="text" class="input1" size="18" readonly></td>
                        <td width="44%"><input name="choise" type="image" onClick="openClassWindow('/ClsMngOperatorAction.do?operatorFlag=<%=OperatorFlagCode.CLSMNG_CHOOSE%>&select=01','选择类别');return false;" src="/agt/public/images/choise.gif" width="48" height="25" border="0" onMouseOver="this.src='/agt/public/images/'+ this.name + '_2.gif';" onMouseOut="this.src='/agt/public/images/'+ this.name + '.gif'"></td>
                      </tr>
                    </table> </td>

    </tr>

    <tr>

      <td align="center" class="td-cs1">测试手段</td>

      <td class="td-cs2"> <select  name="testMeansDis" class="input3">

          <% SysResultSet meansRs  =  TestGetInfo.getMeansRs();



        if(meansRs != null)

        {  for(int i=0;meansRs.setRecord(i)&&i<meansRs.getMetaData().getRecordCount();i++)

           {

      %>

          <option value="<%=meansRs.getString(0)%>"><%=meansRs.getString(1)%></option>

          <%     }

         }

     %>

        </select> </td>

      <td align="center" class="td-cs1">答题参考时间 </td>

      <td class="td-cs2"> <input name="referenceTimeDis" type="text" class="input1" size="18" maxlength="25">

        分钟</td>

    </tr>

    <tr>

      <td align="center" class="td-cs1">使用级别</td>

      <td colspan="3" class="td-cs2"> <select  name="useLevelDis" class="input3">

          <option value="0">常用</option>

          <option value="1">专用</option>

          <option value="2">暂不使用</option>

        </select></td>

    </tr>

  </table>

              <table width="539" height="30" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="35" align="center">
                    <table width="44%" height="25" border="0" cellpadding="0" cellspacing="0">
                      <tr align="left">
                        <td width="50%"><input name="submit" type="image" onClick="checkSubmit();return false;" src="/agt/public/images/submit.gif" width="82" height="22" border="0" onMouseOver="this.src='/agt/public/images/'+ this.name + '_2.gif';" onMouseOut="this.src='/agt/public/images/'+ this.name + '.gif'">
                        </td>
                        <td width="50%"><input name="reset" type="image" onclick="resetForm();return false;" src="/agt/public/images/reset.gif" width="82" height="22" border="0" onmouseover="this.src='/agt/public/images/'+ this.name + '_2.gif';" onmouseout="this.src='/agt/public/images/'+ this.name + '.gif'">
                        </td>
                      </tr>
                    </table></td>
                </tr>
              </table>
              </form>





<form name="changetypeform" method="POST">

   <input type="hidden" name="testType" value="">

</form>



</body>

</html>

<script src="/agt/public/js/scriptfuns.js" type="text/javascript"></script>
<script src="/agt/public/js/my_functions.js" type="text/javascript"></script>

<script language="javascript">



function checkSubmit()

{

    var hcontent = Composition.document.body.innerHTML;

    if(trim(hcontent)=="")

    {

        alert("试题内容不能为空,请输入!");

        return false;

    }

    if(hcontent.length >= 500)

    {

       alert("试题内容长度不能超过500个字符,输入已超过限制长度,请重新输入!")

       return false;

    }



    var explain = document.addtestform.explainDis;

    if(explain.value.length >= 250)

    {

       alert("试题简要说明不能超过250个字符,输入已超过限制长度,请重新输入!")

       explain.focus();
       
       return false;

    }



    var optionDis = document.addtestform.optionDis;

    for(var i=0;i<optionDis.length;i++)

    {

       if(optionDis[i]== null || trim(optionDis[i].value)=="")

       {

          alert("试题的选项不能为空,请输入!");

          optionDis[i].focus();

          return false;

       }

    }



    var classId = document.addtestform.classId;

    if(classId== null || trim(classId.value)=="")

    {

        alert("试题的所属类别不能为空,请输入!");

        return false;

    }



    var	rs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    var rows = document.all.optionTable.rows;

    if(rows.length > 26)

    {

        alert("试题的选项最多为26项,请检查!");

        return false;

    }



    var optionRsDis = document.all.optionRsDis;

    for(var i=0;i<optionRsDis.length;i++)

    {

        var ch = rs.substring(i, i+1);

        optionRsDis[i].value = ch;

    }





    document.addtestform.content.value = hcontent;



    //由于在include文件editor.html之后,取不到参数的值,所以做了如下的处理

    var optionRs = document.addtestform.optionRs;

    optionRs.value = "";

    for(var i=0;i<optionRsDis.length;i++)

    {

        if(optionRsDis[i].checked == true)

        {

           optionRs.value = optionRs.value + optionRsDis[i].value;

        }

    }


    if(optionRs.value == "")

    {

       alert("没有选择试题的答案,请检查!");

       return false;

    }


    var option=document.addtestform.option;

    option.value= optionDis[0].value;

    for(var i=1;i<optionDis.length;i++)

    {

          option.value = option.value + "#" + optionDis[i].value;

    }

    document.addtestform.explain.value = document.addtestform.explainDis.value;



    document.addtestform.degree.value = document.addtestform.degreeDis.value;

    document.addtestform.testMeans.value = document.addtestform.testMeansDis.value;

    document.addtestform.useLevel.value = document.addtestform.useLevelDis.value;

    document.addtestform.referenceTime.value = document.addtestform.referenceTimeDis.value



    document.addtestform.submit();

}



function changeType(value)

{

    document.changetypeform.testType.value =value;

     <%

        if(typeRs != null)

        {  for(int i=0;typeRs.setRecord(i)&&i<typeRs.getMetaData().getRecordCount();i++)

           {

      %>

               if(value == "<%=typeRs.getString(0)%>")

               {

                   document.changetypeform.action = "<%=typeRs.getString(2)%>";

               }

       <%  }

         }

     %>

     document.changetypeform.submit();

}





function resetForm()

{

   document.addtestform.reset();

   Composition.document.body.innerHTML="";

}



function addOption()

{

   var row = document.all.optionTable.insertRow();

   var cell=row.insertCell();

   cell.innerHTML='&nbsp;';

   cell.className="td-cs1";
   var cell1=row.insertCell();

   cell1.className="td-cs2";


   cell1.innerHTML='<input type="checkbox" name="optionRsDis">&nbsp;<input type="text" name="optionDis" class="input2" size="43" maxlength="450"> <input type="checkbox" name="optionCB" id="optionCB">';

}



function delOption()

{



   var allOptionCB = document.all.optionCB;

   var loc=0;
   
   if(allOptionCB == null)
   {
      return false;
   }

   if(allOptionCB.checked == true)
   {
      document.all.optionTable.deleteRow(2);
   }
   
   for(var i=0;i<allOptionCB.length;i++)

   {

       if(allOptionCB[i].checked==true)

       {



           loc = i+2;

           document.all.optionTable.deleteRow(loc);

           i=i-1;

       }

   }



}

document.addtestform.testType.focus();

</script>
<%@ include file="/agt/public/jsp/bot.jsp" %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -