洛奇跑商動(dòng)態(tài)時(shí)間顯示小程序
<!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>巴勒斯至佑拉-港口停留等待時(shí)間:</p0>
? <div>
??? <span id="minutes0"></span> 分鐘
??? <span id="seconds0"></span> 秒
? </div> ?
? <p1>巴勒斯至佑拉-上船停留等待時(shí)間:</p1>
? <div>
??? <span id="minutes1"></span> 分鐘
??? <span id="seconds1"></span> 秒
? </div>
? <p2>巴勒斯至佑拉-乘船運(yùn)行剩余時(shí)間:</p2>
? <div>
??? <span id="minutes2"></span> 分鐘
??? <span id="seconds2"></span> 秒
? </div>
? <input type="button" id="timerstart" value="剛好開船之時(shí)刷新計(jì)時(shí)"/>
?<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>