当前位置:首页 > 程序心得 > 正文内容

JQ 获取验证码倒计时方法

admin10年前 (2016-07-20)程序心得1856
html:
	<a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_default"  id="show-notification">发送验证码</a>

script:
 // 设定倒数秒数
	var timenum = 60;
	// 显示倒数秒数
	function showTime() {
		timenum = timenum - 1;
		if (timenum > 0) {
			$("#show-notification").html(timenum + "s");
			$("#show-notification").attr("onclick", "");
			$("#show-notification").css({
				"cursor" : "default",
				"text-decoration" : "none",
				"color" : "blue"
			});
			// 每秒执行一次,showTime()
			setv = setTimeout("showTime()", 1000);
		} else if (timenum == 0) {
			$("#show-notification").html("获取验证码");
			$("#show-notification").attr("onclick", "sendCode()");
			$("#show-notification").css({
				"cursor" : "pointer",
				"text-decoration" : "none",
				"color" : "#9e9e9e"
			});
			timenum = 60;
		}
	}

blob.png

分享到:

扫描二维码推送至手机访问。

版权声明:本文由云河空间发布,如需转载请注明出处。

本文链接:https://yuyunhe.cn/index.php/post/165.html

分享给朋友:

“JQ 获取验证码倒计时方法” 的相关文章

Thinkphp3.2.x 多图上传几个注意点

1、<form enctype="multipart/form-data">2、<form enctype="multipart/form-data">3、<input type="file...

解决在微信内分享第三方链接标题、图片、摘要、链接等问题

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script> var imgUrl = docum...

Mysql 触发器使用(含navicat使用案例)

Mysql 触发器使用(含navicat使用案例)

CREATE TRIGGER updateutime2 BEFORE UPDATE on yp_cms_score for EACH ROW BEGIN  SET NEW.utime= ...

MySQL获得当前日期时间\时间戳函数

MySQL获得当前日期时间\时间戳函数 1.1 获得当前日期+时间(date + time)函数:now()mysql> select now();+———————+| now() |+———————+| 2008-08-08 22:20:46 |+———————+除了 now()...

多行文字溢出[...]的实现(text-overflow: ellipsis)

多行文字溢出[...]的实现(text-overflow: ellipsis)

对于单行文字, 很简单. Css代码  .oneLine {      width: 200px;      overflow:&...

使用FastClick消除IOS点击延时提高程序的运行效率

FastClick是一个非常方便的库,在移动浏览器上发生介于轻敲及点击之间的指令时,能够让你摆脱300毫秒的延迟。FastClick可以让你的应用程序更加灵敏迅捷。支持各种移动浏览器,比如Safari、Chrome、Opera等。FastClick 是一个简单,易于使用的JS库用于消除在移动浏览器上...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。