zoukankan      html  css  js  c++  java
  • 与考试相关的JS方法

    var IsChange = 0;
    var ensure = 0;



    var
    timeCounter = (function () {//考试剩余时间 倒计时 var int; //var total = 3600;//1小时 var ExamTime = $("[id$='hid_ExamTime']").val();//考试时间 分钟 //alert(ExamTime); var total = ExamTime * 60; return function (elemID) { obj = document.getElementById(elemID); var s = (total % 60) < 10 ? ('0' + total % 60) : total % 60;// var h = total / 3600 < 10 ? ('0' + parseInt(total / 3600)) : parseInt(total / 3600);// var m = (total - h * 3600) / 60 < 10 ? ('0' + parseInt((total - h * 3600) / 60)) : parseInt((total - h * 3600) / 60);// obj.innerHTML = '剩余时间 ' + h + ' : ' + m + ' : ' + s; total--; int = setTimeout("timeCounter('" + elemID + "')", 1000); if (total < -1) { clearTimeout(int); if (window.confirm('考试时间结束,请确认交卷')) { //PostAnswer(); } } } })()

    调用这个JS方法

    function Load() {
                    timeCounter('timeCounter');
    
                    //设置页面自动保存
                    //setTimeout("btnSave()", 10);
                }

    提交答案

     function PostAnswer() {
                    try {
                        ensure = 1;
                        $("[id$='btnSubmitExam']").click();//触发提交按钮事件
                        //alert(111);
    
                    }
                    catch (err) { alert(err); }
                }

    答完的题目,答题卡切换颜色

    function ChangeStatus(Guid) {//改变右侧题目栏题目状态,做完的题目增加 finished 样式
                    try {
                        IsChange = 1;
    
                        $("#AnswerSheet ul li").each(function () {
                            //alert($(this).attr("ID"));
                            if ($(this).attr("ID") == Guid) {
                                //alert($(this).attr("ID"));
                                $(this).addClass('finished');
                            }
                        })
                    }
                    catch (error) {
                        alert('题目切换颜色Js出错,具体错误:' + error);
                    }
                }
    //防止复制和粘贴
    
                document.oncontextmenu = new Function("event.returnValue=false");
                document.onselectstart = new Function("event.returnValue=false");


    考试时间还没有结束,提前交卷

    function SubmitAnswer() {
                    if (window.confirm('考试结束时间还没有到,你确定要交卷?')) {
                        PostAnswer();
                    }
                }
  • 相关阅读:
    Keras安装
    sql根据查询顺序返回结果
    @Configuration @Bean
    SQL高级优化系列
    数据结构与算法系列(二)-- 算法
    数据结构与算法系列(一)-- 数据结构
    Golang中Label的用法
    日志收集系统系列(五)之LogTransfer
    日志收集系统系列(四)之LogAgent优化
    日志收集系统系列(三)之LogAgent
  • 原文地址:https://www.cnblogs.com/lyhsblog/p/6024337.html
Copyright © 2011-2022 走看看