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

📄 showexamitem.jsp

📁 培训考试系统代码
💻 JSP
📖 第 1 页 / 共 2 页
字号:
                    String optionRs = optionRsSet.substring(loc,loc+1);
                    if(testType==1 || testType==2)
                    {
                    %>
                        <tr>
                            <td class="td-cs2" width="30"></td>

                            <td class="td-cs2" ><%=optionRs%>.<input type="radio" name="A<%=alTestId.get(startLocate)%>" value="<%=optionRs%>"><%=stoken.nextToken()%></td>
                        </tr>

                    <%
                    }
                    else if(testType==3)
                    {
                    %>
                        <tr>

                            <td class="td-cs2" width="30"></td>

                            <td class="td-cs2" ><%=optionRs%>.<input type="checkbox" name="A<%=alTestId.get(startLocate)%>" value="<%=optionRs%>"><%=stoken.nextToken()%></td>
                        </tr>
                    <%
                    }
                    else
                    {
                    %>
                        <tr>

                            <td class="td-cs2" width="30"></td>

                            <td class="td-cs2" ><%=optionRs%>.
                                <textarea name="A<%=alTestId.get(startLocate)%>" cols="45" rows="<%=stoken.nextToken()%>" class="remark"></textarea></td>
                        </tr>
                    <%
                    }
                    loc++;
                    
                }
                
%>           

                </table>
            </td>
        </tr> 
    <%
        startLocate++;
    }
    
    %>
    </table>
    <input type="hidden" name="unload" value="0">
    <table width="550" border="0" cellspacing="0" cellpadding="8" align="center">
        <tr>
            <td width="41%" align="right">
            <table width="224" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr align="right">
                    <td width="107">&nbsp;</td>
                    <td width="109">
                    <%
                    if(pageNo==pageCount)
                    {
                    %>
	                <input name="submit" type="image" onclick="submitPaper();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'">
	            <%
	            }
	            else
	            {
	            %>
	                <input name="nextstep" type="image" onclick="nextPaper();return false;" src="/agt/public/images/nextstep.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>
            <td width="59%">      
                <input name="timeLong" type="text" class="input1" onFocus="this.blur()" size="10" >
            </td>
        </tr>
    </table>          
</form>

<script language="javascript">
function submitPaper()
{
    if(window.confirm("是否真的要提交答卷,请确认。"))
    {
        dealPaper();    
        document.onexamform.unload.value = "1";
        document.onexamform.submit();
    }
}

/** 关闭浏览器的时候,运行这个函数来提交试卷 */
function forceSubmitPaper()
{  
      
    if(document.onexamform.unload.value != "1")
    {
        dealPaper();
        document.onexamform.unload.value = "1";
        document.onexamform.submit();
    }
    
     
}

function nextPaper()
{
    var nextPage = <%=pageNo%> + 1;
    dealPaper();
    document.onexamform.unload.value = "1";
    document.onexamform.action = "/agt/onexam/ShowExamItem.jsp?pageNo=" + nextPage + "&startTime=" + <%=startTimeStr%>;
    document.onexamform.submit();
}

function dealPaper()
{
    var testIds = document.onexamform.testIds;
    var testType = document.onexamform.testType;
    var reply = document.onexamform.reply;


    for(var i=0;i<testIds.length;i++)
    {
        var replyItemStr = "document.onexamform.A" + testIds[i].value;

        replyItem = eval(replyItemStr);

        if(testType[i].value == "1" || testType[i].value == "2" || testType[i].value == "3")
        {//判断题 - 单选题-多选题

           for(var j=0;j<replyItem.length;j++)
           {
               if(replyItem[j].checked == true)
               {
                   reply[i].value =  reply[i].value + replyItem[j].value;
               }
           }
        }
        else
        {//填空题,问答题
           if(!(replyItem.length > 1))
           {//只有一条输入
               reply[i].value = replyItem.value;
               if(replyItem.value == "")
               {
                   reply[i].value = " ";
               }
           }
           else
           {//有多条输入
               reply[i].value = replyItem[0].value;
               if(replyItem[0].value == "")
               {
                  reply[i].value = " ";
               }
               for(var j=1;j<replyItem.length;j++)
               {
                   if( replyItem[j].value != "")
                   {
                      reply[i].value = reply[i].value + "#" + replyItem[j].value;
                   }
                   else
                   {
                      reply[i].value = reply[i].value + "#" + " ";
                   }
               }
           }

        }

    }

    if(!(testIds.length > 1))
    {//只有一道题

        var replyItemStr = "document.all.A"+testIds.value;
        replyItem = eval(replyItemStr);

        if(testType.value == "1" || testType.value == "2" || testType.value == "3")
        {//判断题 - 单选题-多选题
            for(var j=0;j<replyItem.length;j++)
           {
               if(replyItem[j].checked == true)
               {
                   reply.value =  reply.value + replyItem[j].value;
               }
           }
        }
        else
        {//填空题,问答题

           if(!(replyItem.length > 1))
           {
               reply.value = replyItem.value;
               /*
               if(replyItem.value == "")
               {
                   reply[i].value = " ";
               }*/
           }
           else
           {
               reply.value = replyItem[0].value;

               for(var j=1;j<replyItem.length;j++)
               {
                   if( replyItem[j].value != "")
                   {
                      reply[i].value = reply[i].value + "#" + replyItem[j].value;
                   }
                   else
                   {
                      reply[i].value = reply[i].value + "#" + " ";
                   }
               }
           }

        }

    }
}
</script>

</body>
</html>

⌨️ 快捷键说明

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