15分钟倒计时

时间:2021-02-05 22:05:23

var x = 15,
interval;
var d = new Date("1111/1/1,0:" + x + ":0");
interval = setInterval(function () {
var m = d.getMinutes();
var s = d.getSeconds();
m = m < 10 ? "0" + m : m;
s = s < 10 ? "0" + s : s;
$(".hint-time").html("请在"+m+"分"+s+"秒内完成支付");
if (m == 0 && s == 0) {
clearInterval(interval);
return;
}
d.setSeconds(s - 1);
}, 1000);