<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
function get_mobile_code()
{
time($("#btnSendCode"),$(".yzmtext"));
}
var wait=5;//时间
function time(o,p) {
if (wait == 0) {
o.removeAttr("disabled");
o.val("重新发送验证码");
p.html("如果您在1分钟内没有收到验证码,请检查您填写的手机号码是否正确或重新发送");
wait=5;
} else {
o.attr("disabled", "true");
o.val("(" + wait + ")秒后重新获取");
p.html("如果您在1分钟内没有收到验证码,请检查您填写的手机号码是否正确或重新发送");
wait--;
setTimeout(function() {
time(o,p);//循环调用
},
1000)
}
}
</script>
</head>
<body>
<p class="yzmtext"></p>
<input id="btnSendCode" type="button" value="发送验证码" onclick="get_mobile_code()" /></p>
</body>
</html>