1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
 5 <script type="text/javascript"> 
 6 var countdown=60; 
 7 function settime(obj) { 
 8     if (countdown == 0) { 
 9         obj.removeAttribute("disabled");    
10         obj.value="免费获取验证码"; 
11         countdown = 60; 
12         return;
13     } else { 
14         obj.setAttribute("disabled", true); 
15         obj.value="重新发送(" + countdown + ")"; 
16         countdown--; 
17     } 
18 setTimeout(function() { 
19     settime(obj) }
20     ,1000) 
21 }
22    
23 </script>
24 <body> 
25 <input type="button" id="btn" value="免费获取验证码" onclick="settime(this)" /> 
26    
27 </body>
28 </html>

 

相关文章:

  • 2021-10-13
  • 2021-09-09
  • 2021-12-03
  • 2021-12-04
  • 2021-11-25
  • 2021-09-10
  • 2022-12-23
猜你喜欢
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
相关资源
相似解决方案