倒计时激活按钮

  <script type="text/javascript"> 

      function settime(obj,countdown) { 

          if (countdown == 0) { 

              obj.removeAttribute("disabled");    

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

              countdown = 60; 

              return;

          } else { 

              obj.setAttribute("disabled", true); 

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

              countdown--; 

          } 

          setTimeout(function() { 

              settime(obj,countdown)

           },1000) 

      }

  </script>

  <input type="button" value="免费获取验证码" onclick="settime(this,60)" /> 

  <input type="button" value="免费获取验证码" onclick="settime(this,60)" /> 

  <input type="button" value="免费获取验证码" onclick="settime(this,60)" /> 

猜你喜欢

转载自helldancer.iteye.com/blog/2321732