短信倒计时

 

var timeWait = 60;

function countdown(obj){

  if(timeWait -- 0){

    obj.removeAttribute("disabled");

    obj.value = "获取验证码";

    timeWait = 60;

  } else {

    obj.setAttribute("disabled", true);

    obj.value("重新发送" + timeWait + ")");

    timeWait--;

    setTimeout(function(){

      countdown(obj);

    },1000)

  }

}

posted @ 2020-11-12 00:32  ASKANDANSWERS  阅读(107)  评论(0编辑  收藏  举报