标签:cloc eth 嵌套循环 answer getc etc 格式 array 网页
1.定义一个方法:
function show() {
//接收开始时间
    var startTime = "${time}";
    var array = startTime.split(":");
    var h1 =parseInt(array[0]);
    var m1 =parseInt(array[1]);
    var s1 =parseInt(array[2]);
//获取当前时间:为number格式
    var now = new Date();
    var h2 = now.getHours();
    var m2 = now.getMinutes();
    var s2 = now.getSeconds();
//计算定时
    var count1 = h1*3600+m1*60+s1;
    var count2 = h2*3600+m2*60+s2;
    var count3 = 45*60 -count2+count1;
    var s3 = count3 % 60;
    var m3 = (count3-s3)/60;
//网页刷新写入数据
    $("#clock").html(m3 + ":" + s3);
//嵌套循环  注意: setTiomeout(show(),500) 无法自动写入
    setTimeout(function (){
        show()
    },500);
}
2.在页面加载完时自动执行
$(function () {
    //c选项的值
    var getC = $("input[name=‘getC‘]").val();
    //图片地址
    var getImg = $("input[name=‘getImg‘]").val();
    //正确答案
    var getAnswer = $("input[name=‘getAnswer‘]").val();
    //解析
    var getReasion = $("input[name=‘getReasion‘]").val();
    if(getC==""){
        $("#c").hide();
        $("#d").hide();
        $("#chooseC").hide();
        $("#chooseD").hide();
    }
    if (getImg==""){
        $("#img").hide();
    }
//执行定时
    show();
});
 标签:cloc eth 嵌套循环 answer getc etc 格式 array 网页
原文地址:https://www.cnblogs.com/wyp01/p/12733033.html