js realizes countdown effect (less than 10 zeros)
- 2021-08-03 08:25:38
- OfStack
Without saying much, please look at the code:
function checkTime(i) {
if (i<10) {
i = "0" +i;
}
return i;
};
function GetRTime(t){
h=Math.floor(t/60/60);
m=Math.floor(t/60%60);
s=Math.floor(t%60);
d = checkTime(d);
h = checkTime(h);
m = checkTime(m);
s = checkTime(s);
$(".hours").val(h);
$(".minutes").val(m);
$(".seconds").val(s);
$(".dot").html(":");
}