js 验证码 倒计时60秒
2015-10-26 10:19
555 查看
js 验证码 倒计时60秒
[html] view plaincopy
<input type="button" id="btn" value="免费获取验证码" />
<script type="text/javascript">
var wait=60;
function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.value="免费获取验证码";
wait = 60;
} else {
o.setAttribute("disabled", true);
o.value="重新发送(" + wait + ")";
wait--;
setTimeout(function() {
time(o)
},
1000)
}
}
document.getElementById("btn").onclick=function(){time(this);}
</script>
[html] view plaincopy
<input type="button" id="btn" value="免费获取验证码" />
<script type="text/javascript">
var wait=60;
function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.value="免费获取验证码";
wait = 60;
} else {
o.setAttribute("disabled", true);
o.value="重新发送(" + wait + ")";
wait--;
setTimeout(function() {
time(o)
},
1000)
}
}
document.getElementById("btn").onclick=function(){time(this);}
</script>
相关文章推荐
- WdatePicker.js的使用方法 帮助文档 使用说明(时间控件)
- javaScript实现可缩放的显示区效果代码
- 疯狂Html+CSS+JS 中CSS总结
- JSP取得绝对路径
- 疯狂Html+CSS+JS 中CSS总结
- 疯狂Html+CSS+JS 中CSS总结
- 疯狂Html+CSS+JS 中CSS总结
- 5、Jsp 核心标签库
- JS基于VML技术实现的五角星礼花效果代码
- 2、Jsp 标签 与 freemarker macor 开发比较
- JS遮罩层
- 1.jsp 与 freemarker 比较
- pjsua帮助手册(中文)
- javascript删除字符串最后一个字符的几种方法
- 关于js中namespace命名空间模式
- 安卓解析中JSON中getString() 和optString()的区别
- 网页中实现JSON的编辑与显示
- 几种js中常用到的真假值判断
- JavaScript的执行上下文
- three.js 来源目光(十三)Math/Ray.js