function countDown(){
var count = ""
for(var i = 10; i > 0; i--){
count = i;
setInterval(function(){show(count)}, 1000);
// i've try : setInterval(show(count), 1000);
}
}
function show(count){
document.getElementById('tes').innerHTML = count;
}
不要标记为重复,这是不同的事情!
这只是实验,
答案 0 :(得分:0)
代码应为
function countDown(){
var count = "";
for(var i = 10; i > 0; i--){
count = i;
setInterval(show(count), 1000); //call function, do not create one here
// i've try : setInterval(show(count), 1000);
}
}
function show(count){
document.getElementById('tes').innerHTML = count;
}
countDown(); //invokation