循环计时器

<input type="button" id="btn" value="开始答题">


var start = 3;
var step = -1;
var k=0;
function count()
{
document.getElementById("btn").value ="倒计时:"+ start+"s";
start += step;
if(start <=0){
start = 3;


//倒计时4次停止计时
if(k<4){
  //在循环时的操作


}else{

  //清除计时器
  clearTimeout(timer);
}
}
var timer= setTimeout("count()",1000);

}
window.onload = count;

posted @ 2017-12-15 18:02  xzzzys  Views(421)  Comments(0Edit  收藏  举报