码迷,mamicode.com
首页 > 其他好文 > 详细

淘宝60秒倒计时

时间:2015-05-04 17:43:47      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
  <title>60秒倒计时</title>
  <script type="text/javascript">
    window.onload=function(){
      var oBtn = document.getElementById(but);
      var conut = 60;
      var timer = null;
      oBtn.onclick=function(){
        timer=setInterval(function(){
          settime()
        },1000)
      }
      function settime(){
        if(conut == 0){
          oBtn.value = 免费获取验证码;
          oBtn.removeAttribute("disabled");
          clearInterval(timer);
          conut=60;
        }else{
          conut --;
          oBtn.value = conut +后可以重发;
          oBtn.setAttribute("disabled", true); 
        }
      }
    }
  </script>
</head>
<body>
  <input type="button" value="免费获取验证码" id="but">
</body>
</html>

 

淘宝60秒倒计时

标签:

原文地址:http://www.cnblogs.com/heboliufengjie/p/4476431.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!