获取验证码,60秒倒计时js
2015-09-03 18:20
841 查看
<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>
<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>
相关文章推荐
- js正则表达式的使用与详解
- JSF中怎么使用Enum生成下拉列表
- Javascript高级程序设计——面向对象之创建对象
- javascript继承方式详解
- net extjs tree异步加载数据
- Hello JSP!——JSP动作元素分类
- bzoj1029 [JSOI2007]建筑抢修
- js 取模 取余
- ExtJs 入门教程二十二[动态复选框:RemoteCheckboxGroup]
- ExtJs 入门教程二十一[继承:Extend]
- ExtJs 入门教程二十[数据交互:AJAX]
- ExtJs 入门教程十九[API的使用]
- ExtJs 入门教程十八[树:TreePanel]
- ExtJs 入门教程十七[列表:GridPanel]
- ExtJs 入门教程十六[页面布局:Layout]
- ExtJs 入门教程十五[员工信息表Demo:AddUser]
- ExtJs 入门教程十四[文本编辑器:Editor]
- ExtJs 入门教程十三[上传图片:File]
- ExtJs 入门教程十二[下拉列表联动:Combobox_Two]
- ExtJs 入门教程十一[下拉列表:Combobox]