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

📄 testaddvacancy.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 class="remark" colspan="2">

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

  </tr>



  </table>



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

    <tr>



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





                        <td class="td-cs2">
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="38%">(行数)
                                <input name="rowCount" type="text" class="input1" value="1" size="3" maxlength="3">
                              </td>
                              <td width="62%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="20%"><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="80%"><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 colspan="84%" class="td-cs2">

        <textarea name="optionRsDis" cols="55" rows="5" class="remark"></textarea>

	        <input type="hidden" name="optionDis" value="2">

	       

	        </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>
<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 optionRsDis = document.addtestform.optionRsDis;

    if(optionRsDis == null)

    {

        alert("没有试题的答案项,请增加!");

        return false;

    }



    if(!(optionRsDis.length>1))

    {//只有一个答案项

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

        {

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

             optionRsDis.focus();

             return false;

        }



    }

    else

    {

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

       {

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

          {

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

             optionRsDis[i].focus();

             return false;

          }

       }

    }



    var classId = document.addtestform.classId;

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

    {

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

        return false;

    }



    document.addtestform.content.value = hcontent;



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



    var option=document.addtestform.option;

    var optionRs = document.addtestform.optionRs;

    var optionDis = document.addtestform.optionDis;

    if(!(optionRsDis.length>1))

    {//只有一个答案项

       option.value = optionDis.value;

       optionRs.value = optionRsDis.value;

    }

    else

    {

       option.value = optionDis[0].value;

       optionRs.value = optionRsDis[0].value;

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

       {

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

          optionRs.value = optionRs.value + "#" + optionRsDis[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();

}

document.addtestform.testType.focus();

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 rowCount = document.all.addtestform.rowCount;

   if(rowCount.value)



    if(rowCount == null || rowCount.value == "")

    {

        alert("增加试题答案输入项所指定的行数不能为空,请输入!");

        rowCount.focus();

        return false;

    }

    if( !isNumber(rowCount.value) || rowCount.value > 999 ||  rowCount.value == 0)

    {

        alert("增加试题答案输入项所指定的行数输入不正确,请重新输入!");

        rowCount.focus();

        return false;

    }





   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='<textarea class="remark" rows="'+ rowCount.value + '" name="optionRsDis" cols="45"></textarea> <input type="hidden" name="optionDis" value="'+ rowCount.value +'"> <input type="checkbox" name="optionCB" id="optionCB">';

}



function delOption()

{
   var allOptionCB = document.all.optionCB;

   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)

       {

           document.all.optionTable.deleteRow(i+2);

           i=i-1;

       }

   }



}



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

⌨️ 快捷键说明

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