一次性定時器:setTimeout
清除一次性定時器用clearTimeout
var timer=setTimeout(show,3000);
btn1.onclick=function(){
clearTimeout(timer);
}
永久性定時器:setInterval
清除永久性定時器用clearInterval
var times=setInterval(print,1000);
btn2.onclick=function(){
clearInterval(times);
}