<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<title>60s倒计时</title>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<input type="button" id="btn" value="免费获取验证码" />
<script type="text/javascript">
//发送验证码按钮的60s倒计时
var countdown = 60;
$('#btn').css('background','#0af');
$('#btn').css('border','none');
$('#btn').css('borderRadius','5px');
$('#btn').css('height','30px');
$('#btn').css('color','#fff');
function sendemail(obj) {
// var obj = $("#btn");
settime(obj);
}
function settime(obj) {
if (countdown == 0) {
obj.attr('disabled', false);
obj.val("免费获取验证码");
countdown = 60;
return;
} else {
obj.attr('disabled', true);
obj.val("重新发送(" + countdown + ")");
countdown--;
$('#btn').css('background', '#999')
}
setTimeout(function() {
settime(obj)
}, 1000)
}
$('#btn').click(function() {
settime($('#btn'))
})
</script>
</body>
</html>
然后呢 有什么问题
我做个记录!
@小猴子会上树: 直接写个随笔 博客 都可以
@竜咚咚: 谢谢