淘宝60秒倒计时

<!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>
时间: 2024-10-08 19:22:43

淘宝60秒倒计时的相关文章

验证码60秒倒计时

验证码60秒倒计时(jQuery), 代码如下: //验证码倒计时 var countdown = 60; var st; function settime(element) { if (countdown != 0) { st = setTimeout(function () { settime(element); }, 1000); } if (countdown == 0) { element.removeAttr("disabled"); element.val("获

js jquery 按钮点击后 60秒之后才能点击 60秒倒计时

var wait = 60; function time(o) { if (wait == 0) { $(o).attr("disabled", false); $(o).val("获取验证码"); wait = 60; } else { $(o).attr("disabled", true); o.val(wait + "秒后重新发送"); wait--; setTimeout(function () {time(o);},

js实现60秒倒计时效果(使用了jQuery)

今天碰到要实现一个类似那种短信验证码60秒倒计时的需求,好久不写js,有点手生.把代码记录下,方便后续查阅. 这里我用了jQuey,毕竟写起来简洁点.下面直接看效果和代码. 一.效果 二.代码 (1)html <input type="button" id="btn" value="免费获取验证码" onclick="daojishi(10,this)" /> 注意:要引入JQuery (2)js <scri

yii框架实现注册页面短信验证60秒倒计时

先说下简单的,直接用jquery来实现短信验证60秒倒计时,然后在说明在yii框架下怎么实现的. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

点击按钮出现60秒倒计时js代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

60秒倒计时

<input type="button" id="btn" value="免费获取验证码" onclick="settime(this)" /> <script type="text/javascript"> var countdown=60; function settime(val) { if (countdown == 0) { val.removeAttribute(&quo

Jquery 插件防刷新 60秒倒计时

//先到官网(http://plugins.jQuery.com/cookie/)下载cookie插件,放到相应文件夹,代码如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>

jQuery实现发送短信验证码后60秒倒计时

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> var countdown=60; functi

60秒倒计时,自动跳转到指定页面

<script type="text/javascript" charset="utf-8"> //设定倒数秒数 var t = 60; //显示倒数秒数 function showTime(){ t -= 1; document.getElementById('jumpTo').innerHTML= t; if(t==0){ location.href='http://www.baidu.com'; } //每秒执行一次,showTime() setT