clearTimeout(i)中clearTimeout怎么就知道i=setTimeout呢?clearTimeout和setTimeout不在同一个函数里
var num=0,i;
function timedCount(){
document.getElementById('txt').value=num;
num=num+1;
i=setTimeout(timedCount,1000);
}
setTimeout(timedCount,1000);
function stopCount(){
clearTimeout(i);
}