短信验证码倒计时
来源:互联网 发布:手机上网数据自动关闭 编辑:程序博客网 时间:2024/05/17 01:27
普通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-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <script type="text/javascript" src="js/jquery.js"></script> </head> <body> <input type="button" id="btn" value="免费获取验证码" onclick="settime(this)" /> <script type="text/javascript"> var countdown=60; function settime(val) { if (countdown == 0) { val.removeAttribute("disabled"); val.value="免费获取验证码"; countdown = 60; } else { val.setAttribute("disabled", true); val.value="重新发送(" + countdown + ")"; countdown--; setTimeout(function() { settime(val) },1000) } } </script> </body> </html>
angularJS
angularJS获取事件元素
在angularJS中获取事件元素的方法: 在函数参数中传入$event参数,在函数中使用$event.target就可以获取到了
<div class="form-group"> <div style="width: 50%;float: left;"> <input type="text" class="form-control" ng-model="param.identifyCode" name="identifyCode" id="identifyCode" placeholder="验证码" required=""> </div> <div style="width: 45%;float: right;"> <button type="button" ng-click="setTime($event)" id="getIdentifyCode" class="btn m-b-xs w-xs btn-primary">获取短信验证码</button> </div> <div class="clear"></div></div>
$scope.countdown = 60;$scope.setTime = function($event){ var elem = $event.target; if ($scope.countdown == 0) { elem.removeAttribute("disabled"); elem.innerHTML = "获取短信验证码"; $scope.countdown = 60; } else { elem.setAttribute("disabled", true); elem.innerHTML = "重新发送(" + $scope.countdown + ")"; $scope.countdown--; setTimeout(function() { $scope.setTime($event) },1000) }};
阅读全文
0 0
- 短信验证码倒计时
- 短信验证码倒计时
- 短信验证码倒计时
- iOS 倒计时功能(短信验证码)
- android获取短信验证码倒计时
- 自定义短信验证码中的倒计时控件
- android 获取短信验证码倒计时
- 短信验证码60秒倒计时
- IOS短信验证码倒计时添加
- 实现短信验证码获取倒计时
- 短信验证码倒计时+GCD实现
- 获取短信验证码倒计时效果
- android 获取短信验证码倒计时
- 模拟 短信验证码 按钮倒计时
- 获取短信验证码 倒计时 CountDownTimer
- 安卓短信验证码倒计时效果
- android 获取短信验证码倒计时功能
- 短信验证码倒计时的实现
- 2017华为软件精英挑战赛系列一
- redis
- 【脚本语言系列】关于PythonWeb服务自动化BeautifulSoup,你需要知道的事
- 使用阿里云OSS服务器进行web签名直传
- 《利用python进行数据分析》学习笔记(二)
- 短信验证码倒计时
- PCL 环境搭建与例程
- servlet — .xml
- Oracle 分组后,对组内数据进行排序
- KMP算法模板
- [区块链]Hyperledger Fabric源代码(基于v1.0 beta版本)阅读之乐扣老师解读系列 (二)Fabric模块分析
- svn命令在linux下的使用
- 虚拟机的类加载的时机
- MyBatis代码自动生成(利用命令)