我想在 h = 0 时清除 interverl;米 = 0; s = 0;
怎么做...这总是循环...
看代码
var h = 10;
var m = 11;
var s = 12;
function countdown() {
h--;
m--;
s--;
var t = h + ":" + m + ":" + s;
document.getElementById("show").innerHTML = t;
if (h == 0 && m == 0 && s == 0) {
clearInterval(timer);
}
}
var timer = setInterval('countdown()',1000);
countdown();