您的位置:首页 > 其它

点击获取验证码按钮后按钮变灰,倒计时一段时间后又可重复点击

2015-01-05 14:13 411 查看
html中:

js中:

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_x_x_x_x_x_x_x("btn").onclick=function(){time(this);}

以上是简单的js代码,相关网页技术交流请加群: 99344911

本文出自 “芭菲雨的博客” 博客,请务必保留此出处http://bafeiyu.blog.51cto.com/5401101/1599274
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐