欢迎光临散文网 会员登陆 & 注册

洛奇跑商动态时间显示小程序

2023-08-26 03:29 作者:大尽长虹  | 我要投稿

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style type="text/css">
    body,html {margin:0; height:100%;}
    </style>
</head>
<body>  
  <p0>巴勒斯至佑拉-港口停留等待时间:</p0>
  <div>
    <span id="minutes0"></span> 分钟
    <span id="seconds0"></span> 秒
  </div>  
  <p1>巴勒斯至佑拉-上船停留等待时间:</p1>
  <div>
    <span id="minutes1"></span> 分钟
    <span id="seconds1"></span> 秒
  </div>
  <p2>巴勒斯至佑拉-乘船运行剩余时间:</p2>
  <div>
    <span id="minutes2"></span> 分钟
    <span id="seconds2"></span> 秒
  </div>
  <input type="button" id="timerstart" value="刚好开船之时刷新计时"/>
 <script type="text/javascript">
    var targetDaten = new Date();
    var targetDate = targetDaten -60000;
    document.getElementById("timerstart").addEventListener("click", function cut(){
    targetDaten = new Date();
    targetDate = targetDaten -60000;
    }
    )
        function countdown0(){
            var numa = 0;      
            setTimeout(timedCount(numa),1000);             
            function timedCount(numa){                
            numa++;
            setTimeout(function(){timedCount(numa)},1000);
            var numaz = Math.floor(numa/660);
    var Nontm1 = new Date("1970-01-01 00:11:00");
    var Nontm2 = new Date("1970-01-01 00:00:00");
    var Nontma = Nontm2 - Nontm1;
    var currentDate0 = new Date();
    var diff0 = targetDate - currentDate0 - Nontma*numaz - (300000);
    var minutes0 = Math.floor((diff0 % (1000 * 60 * 60)) / (1000 * 60));
    var seconds0 = Math.floor((diff0 % (1000 * 60)) / 1000);
    document.getElementById("minutes0").innerText = minutes0;
    document.getElementById("seconds0").innerText = seconds0;
            }
        }

        function countdown1(){
            var numb = 0;      
            setTimeout(timedCount(numb),1000);             
            function timedCount(numb){                
            numb++;
            setTimeout(function(){timedCount(numb)},1000);
            var numbz = Math.floor(numb/660);
    var Nontm3 = new Date("1970-01-01 00:11:00");
    var Nontm4 = new Date("1970-01-01 00:00:00");
    var Nontmb = Nontm4 - Nontm3;
    var currentDate1 = new Date();
    var diff1 = targetDate - currentDate1 - Nontmb*numbz - (-60000);
    var minutes1 = Math.floor((diff1 % (1000 * 60 * 60)) / (1000 * 60));
    var seconds1 = Math.floor((diff1 % (1000 * 60)) / 1000);
    document.getElementById("minutes1").innerText = minutes1;
    document.getElementById("seconds1").innerText = seconds1;
            }
        }

        function countdown2(){
            var numc = 0;      
            setTimeout(timedCount(numc),1000);             
            function timedCount(numc){                
            numc++;
            setTimeout(function(){timedCount(numc)},1000);
            var numcz = Math.floor(numc/660);
    var Nontm5 = new Date("1970-01-01 00:11:00");
    var Nontm6 = new Date("1970-01-01 00:00:00");
    var Nontmc = Nontm6 - Nontm5;
    var currentDate2 = new Date();
    var diff2 = targetDate - currentDate2 - Nontmc*numcz - (-300000);
    var minutes2 = Math.floor((diff2 % (1000 * 60 * 60)) / (1000 * 60));
    var seconds2 = Math.floor((diff2 % (1000 * 60)) / 1000);
    document.getElementById("minutes2").innerText = minutes2;
    document.getElementById("seconds2").innerText = seconds2;
            }
        }
        setTimeout(countdown0, 1000);
        setTimeout(countdown1, 1000);
        setTimeout(countdown2, 1000);
        </script>
</body>
</html>

洛奇跑商动态时间显示小程序的评论 (共 条)

分享到微博请遵守国家法律