已注销用户
2015-04-28 11:50:33
证
jquery实现手机验证码倒计时效果
一个简单的js效果
主要有2部分:
1.页面代码:
<a onclick=”getcode()” id=”once_get” one=”false”>获取验证码<a>
2.JS代码:
<script> var onceGetTime = 60; function sendCode(){ if(onceGetTime > 1){ onceGetTime--; $("#once_get").html("重新获取("+onceGetTime+")"); setTimeout(arguments.callee,1000); }else{ $("#once_get").html("获取验证码"); $("#once_get").attr("one",false); } } //发送 function getcode(){ //避免重复发 if ($("#once_get").attr("one")=='true'){ return false; } //异步获取验证码,并发送的程序,当发送成功后回调函数调用 //以下的代码 $("#once_get").attr("one",true); onceGetTime=60; sendCode(); } </script>
效果图,如下:
猜你喜欢
请下载代码后再发表评论
![最代码相关代码源代码列表](https://static.zuidaima.com/resource/img/heart_ico.png)
![最代码最近下载分享源代码列表](https://static.zuidaima.com/resource/img/heart_ico.png)
YiRenHun LV11
2023年12月5日
dushuzhong LV7
2022年5月3日
s779766816 LV10
2020年9月22日
gengyupin LV2
2020年7月7日
难搞啊 LV1
2019年9月23日
lw19900921 LV25
2019年5月19日
yiangeee LV9
2019年1月12日
NoBugNoLife LV7
2018年6月14日
Onlyli LV14
2018年5月30日
lkduhuan LV19
2018年2月7日
![最代码最近浏览分享源代码列表](https://static.zuidaima.com/resource/img/cattle_ico.png)
48862207 LV3
6月1日
阿博1994 LV4
3月24日
杜杜杜杜杜杜
2023年12月26日
暂无贡献等级
YiRenHun LV11
2023年12月5日
江屿初 LV8
2023年12月4日
秋月常 LV1
2023年4月11日
150252812 LV5
2022年10月1日
andywong73 LV1
2022年9月16日
51106397
2022年6月21日
暂无贡献等级
dushuzhong LV7
2022年5月3日