<script src="http://code.jquery.com/jquery-latest.js"></script>
<input type="button" onclick="setclock($(this),5);" value="获取验证码">
<a href="javascript:void(0);">获取验证码</a> <script>
$("a").click(function(){
setclock($(this),5);
}); function setclock(dom,value,text,type)
{
value=arguments[1]||60;
text=arguments[2]||"s后重发验证码";
type=arguments[3]||"other"; //if(type!="other"||dom.attr("disabled")!="disabled")
if(!(type=="other"&&dom.attr("disabled")=="disabled"))
{
dom.attr("disabled","disabled");
if(dom[0].nodeName=='INPUT')
{
jQuery.prototype.comValue=jQuery.prototype.val;
}else
{
jQuery.prototype.comValue=jQuery.prototype.text;
} if(!dom.attr("data-clock"))
{
dom.attr("data-dvalue",dom.comValue());
value--;
dom.attr("data-clock",value);
dom.comValue(value+text);
}else
{
var thisValue=parseInt(dom.attr("data-clock"))-1;
dom.attr("data-clock",thisValue);
dom.comValue(thisValue+text);
} if(parseInt(dom.attr("data-clock"))>0)
{
setTimeout(function(){setclock(dom,value,text,"self")},1000);
}else
{
dom.removeAttr("disabled"); dom.removeAttr("data-clock");
dom.comValue(dom.attr("data-dvalue"));
}
}
}
</script>

js获取验证码 秒表效果(原创)的更多相关文章

  1. Andorid实现点击获取验证码倒计时效果

    这篇文章主要介绍了Andorid实现点击获取验证码倒计时效果,这种效果大家经常遇到,想知道如何实现的,请阅读本文   我们在开发中经常用到倒计时的功能,比如发送验证码后,倒计时60s再进行验证码的获取 ...

  2. JS实现验证码倒计时效果

    通常做注册页面时会有获取验证码按钮,然后点击后过60秒才能重新获取,比如现在项目中遇到的 然后点击后的样式,并且数字是递减的,到0时重新回到最初的状态(上图). 首先构造HTML结构 <butt ...

  3. JS获取验证码后倒计时不受刷新及关闭影响

    HTML部分 <input type="button" id="code_btn" value="获取验证码"> JS部分 // ...

  4. js 获取验证码计时器

    效果图: 贴上代码: <div class="logintitle"> <input type="tel" id="mobile&q ...

  5. JS 获取验证码 倒计时

    setInterval 一个定时器搞定 <style> button{ background: #45BCF9; color: #fff; padding: 4px 10px; borde ...

  6. ASP.NET中图片验证码与js获取验证码的值

    现在的程序中,为了防止用户恶意点击,我们一般都会加上验证,现在比较普遍的是加上图片验证码或者手机短信验证.验证码一般都是防机器不防人,有效的防止了恶意点击. 那么在webform中如何生成动态的图片验 ...

  7. java结合js获取验证码

    框架springmvc 1.后台java代码: package com.fh.controller.system.secCode; import java.awt.Color; import java ...

  8. JS 获取验证码按钮改变案例

    HTML代码 <div class="box"> <label for="">手机号</label> <input t ...

  9. 如何用JavaScript实现获取验证码的效果

    转自:http://www.php.cn/js-tutorial-411734.html HTML部分: 1 2 3 4 5 6 7 <body onload='createCode()'> ...

随机推荐

  1. 在命令提示符窗口下(cmd)使用指令操作并编译java代码,运行java编译代码

    使用cmd操作java代码,编译.java文件,运行.class文件. 操作步骤: 1:创建一个文件夹: 例如:在e盘根目录(\)下面创建一个名为Hello的文件夹: 使用md指令:如图 在e盘中会生 ...

  2. VHDL之concurrent之generate

    GENERATE It is another concurrent statement (along with operators and WHEN). It is equivalent to the ...

  3. Swift - AnyClass,元类型和 .self

    在Swift中能够表示 “任意” 这个概念的除了 Any 和 AnyObject 以外,还有一个AnyClass.我们能够使用AnyClass协议作为任意类型实例的具体类型.AnyClass在Swif ...

  4. JS的Key-Val(键值对)设置Key为动态的方法

    问题描述: 需要生成一个对象, 这个对象为 {key: value}, 现在要让key是动态的 解决方案: function(key, value){ let keyValue = {}; keyVa ...

  5. matlab学习使用Button Group绘制不同的正弦曲线

    创建buttongroup控件---即按钮组 再添加三个radiobutton 对其设置 buttongroup控件改Title为绘制不同正弦曲线 第一个radiobutton的string改为sin ...

  6. day8 面向对象编程基础

    活在当下的程序员应该都听过“面向对象编程”一词,也经常有人问能不能用一句话解释下什么是“面向对象编程”,我们先来看看比较正式的说法. 把一组数据结构和处理它们的方法组成对象(object),把相同行为 ...

  7. centos最小化系统安装VMware tool

    1.先执行命令创建环境 yum -y install update yum -y install gcc kernel-headers kernel-devel 2.然后重启reboot 3.挂载,解 ...

  8. 20.基于es内部_version进行乐观锁并发控制

  9. (23)Spring Boot启动加载数据CommandLineRunner【从零开始学Spring Boot】

    [Spring Boot 系列博客] )前言[从零开始学Spring Boot] : http://412887952-qq-com.iteye.com/blog/2291496 )spring bo ...

  10. Disruptor使用

    Disruptor作者,介绍Disruptor能每秒处理600万订单.这是一个可怕的数字. disruptor之所以那么快,是因为内部采用环形队列和无锁设计.使用cas来进行并发控制.通过获取可用下标 ...