效果:

JS - 按钮倒计时

JS - 按钮倒计时

 

html代码:

<input type="button"  />

 

js代码:

	//倒计时
	var wait=60;
	function time(o) {
        if (wait == 0) {
            o.removeAttribute("disabled");          
            o.value="点击获取效验码";
            wait = 60;
        } else {
            o.setAttribute("disabled", true);
            o.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                time(o)
            },
            1000)
        }
    }
	//调用
	time(this);

 

相关文章:

  • 2021-11-27
  • 2021-12-04
  • 2021-10-19
  • 2021-08-31
  • 2021-08-21
  • 2019-11-02
  • 2021-10-29
  • 2021-09-26
猜你喜欢
  • 2021-10-19
  • 2021-10-19
  • 2021-09-26
  • 2021-09-10
  • 2021-10-19
  • 2021-09-26
  • 2021-09-26
  • 2021-09-26
相关资源
相似解决方案