湖北皖能公司

作者:ca88
$(function() {
      var _minute = parseInt("${exampaper.paperTime }");
      var _expiresHours = _minute * 60 * 1000;

      if(!hasSetCookie()){
        addCookie("${examinee.examineeId}", _expiresHours, _expiresHours);
      } 
      settime($("#remainTime")); 
    });
    function hasSetCookie(){
      var strCookie = document.cookie;
      var arrCookie = strCookie.split("; ");
      for (var i = 0; i < arrCookie.length; i  ) {
        var arr = arrCookie[i].split("=");
        if (arr[0] == "${examinee.examineeId}") {
          return true;
        }
      };
      return false;
    }
    //开始倒计时
    function settime(remainTime) {
      var _time = getCookieValue("871d31bacfd4451484c5f70f8860c2a9");
      var _countdown = parseInt(getCookieValue("${examinee.examineeId}")) / 1000;

      if (_countdown <= 0) {
        alert("考试时间到!");
        endExam();
      } else {
        var _second = _countdown % 60;
        var _minute = parseInt(_countdown / 60) % 60;
        var _hour = parseInt(parseInt(_countdown / 60) / 60);

        if (_hour < 10)
          _hour = "0"   _hour.toString();
        if (_second < 10)
          _second = "0"   _second.toString();
        if (_minute < 10)
          _minute = "0"   _minute.toString();

        remainTime.html(_hour   ":"   _minute   ":"   _second);
        _countdown--;
        editCookie("${examinee.examineeId}", _countdown * 1000, _countdown * 1000);
      }
      //每1000毫秒执行一次
      setTimeout(function() {
        settime(remainTime);
      }, 1000);
    };

    //时添加cookie
    function addCookie(name, value, expiresHours) {
      var cookieString = name   "="   escape(value); //escape() 函数可对字符串进行编码,这样就可以在所有的计算机上读取该字符串。
      //判断是否设置过期时间,0代表关闭浏览器时失效
      if (expiresHours > 0) {
        var date = new Date();
        date.setTime(date.getTime()   expiresHours * 1000);
        cookieString = cookieString   ";expires="   date.toUTCString();
      }
      document.cookie = cookieString;
    }

    //修改cookie的值
    function editCookie(name, value, expiresHours) {
      var cookieString = name   "="   escape(value);
      if (expiresHours > 0) {
        var date = new Date();
        date.setTime(date.getTime()   expiresHours * 1000); //单位是毫秒
        cookieString = cookieString   ";expires="   date.toGMTString();
      }
      document.cookie = cookieString;
    }

    //根据名字获取cookie的值
    function getCookieValue(name) {
      var strCookie = document.cookie;
      var arrCookie = strCookie.split("; ");
      for (var i = 0; i < arrCookie.length; i  ) {
        var arr = arrCookie[i].split("=");
        if (arr[0] == name) {
          return unescape(arr[1]);
          break;
        } else {
          continue;
        };
      };
    }

ca88 ,基于jQuery Cookie完毕的警务器具刷新的在线考试倒计时,jquerycookie

凭仗jQuery Cookie达成的防守刷新的在线考试倒计时

$(function() {
      var _minute = parseInt("${exampaper.paperTime }");
      var _expiresHours = _minute * 60 * 1000;

      if(!hasSetCookie()){
        addCookie("${examinee.examineeId}", _expiresHours, _expiresHours);
      } 
      settime($("#remainTime")); 
    });
    function hasSetCookie(){
      var strCookie = document.cookie;
      var arrCookie = strCookie.split("; ");
      for (var i = 0; i < arrCookie.length; i  ) {
        var arr = arrCookie[i].split("=");
        if (arr[0] == "${examinee.examineeId}") {
          return true;
        }
      };
      return false;
    }
    //开始倒计时
    function settime(remainTime) {
      var _time = getCookieValue("871d31bacfd4451484c5f70f8860c2a9");
      var _countdown = parseInt(getCookieValue("${examinee.examineeId}")) / 1000;

      if (_countdown <= 0) {
        alert("考试时间到!");
        endExam();
      } else {
        var _second = _countdown % 60;
        var _minute = parseInt(_countdown / 60) % 60;
        var _hour = parseInt(parseInt(_countdown / 60) / 60);

        if (_hour < 10)
          _hour = "0"   _hour.toString();
        if (_second < 10)
          _second = "0"   _second.toString();
        if (_minute < 10)
          _minute = "0"   _minute.toString();

        remainTime.html(_hour   ":"   _minute   ":"   _second);
        _countdown--;
        editCookie("${examinee.examineeId}", _countdown * 1000, _countdown * 1000);
      }
      //每1000毫秒执行一次
      setTimeout(function() {
        settime(remainTime);
      }, 1000);
    };

    //时添加cookie
    function addCookie(name, value, expiresHours) {
      var cookieString = name   "="   escape(value); //escape() 函数可对字符串进行编码,这样就可以在所有的计算机上读取该字符串。
      //判断是否设置过期时间,0代表关闭浏览器时失效
      if (expiresHours > 0) {
        var date = new Date();
        date.setTime(date.getTime()   expiresHours * 1000);
        cookieString = cookieString   ";expires="   date.toUTCString();
      }
      document.cookie = cookieString;
    }

    //修改cookie的值
    function editCookie(name, value, expiresHours) {
      var cookieString = name   "="   escape(value);
      if (expiresHours > 0) {
        var date = new Date();
        date.setTime(date.getTime()   expiresHours * 1000); //单位是毫秒
        cookieString = cookieString   ";expires="   date.toGMTString();
      }
      document.cookie = cookieString;
    }

    //根据名字获取cookie的值
    function getCookieValue(name) {
      var strCookie = document.cookie;
      var arrCookie = strCookie.split("; ");
      for (var i = 0; i < arrCookie.length; i  ) {
        var arr = arrCookie[i].split("=");
        if (arr[0] == name) {
          return unescape(arr[1]);
          break;
        } else {
          continue;
        };
      };
    }

如上所述就是本文的全部内容了,希望大家能够欣赏。

基于jQuery Cookie完结的防守刷新的在线考试倒计时 $(function() { var _minute = parseI...

ca88 1

上述所述正是本文的全体内容了,希望大家能够喜欢。

7月五日,皖能慈云山公司人力能源部和燃料运输部在多媒体体育地方共同组织了一次特别的在线工夫规程考试。考试中,第贰回尝试同场考试测验差异专门的工作职员,使用差异标准试卷。 此次在线考试共有三十四位与会,他们来自燃运部的逐壹地方,分为班长、卸船机司机、斗轮机司机、输煤驾控员和巡检兼电工5个专门的学问技术岗位。为了知足各职位的试验须要,人资部和燃运部的扶植职员积极性筹措,经过认真组卷、调节和测量检验,终于第一次达成了5套考卷在一场考试中集中开考。整个考试进度很顺畅,考试完成后,在线考试系统自动生成考试战绩,同不经常间还对成就实行横向和纵向深入分析,为后来培养和陶冶工作提供了连带深入分析数据。 集团多媒体体育场面自三月份投用以来,已经拓展了手艺讲座和各个考试共计达到11场次。先进的在线考试系统,不只能够完毕考试无纸化,还巩固了陶铸和考试的功用,节约了人工和能源。

本文由ca88发布,转载请注明来源

关键词: ca88网址 ca88客户端下载 安徽 集团