【发布时间】:2018-02-24 03:13:37
【问题描述】:
我正试图让我的时钟停在零,然后显示结果 pg。但现在我无法让它停下来。
var clock = {
time: 2,
timeleft: 0,
bigben: null,
countDown: function() {
clock.time--;
$("#timer").html(clock.time);
},
start: function() {
bigben = setInterval(clock.countDown, 1000);
},
stop: function() {
// clearInterval(intervalId);
if (time == timeleft) {
window.clearInterval(bigben);
// Display countdown
$('#timer').html(time + "seconds");
time--
}
//end of timer
if (time === timeleft) {
window.clearInterval(bigben);
gameOver();
};
},
【问题讨论】:
标签: javascript jquery time countdown countdowntimer