<!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jq 倒计时代码发送验证码</title><script language="javascript"> //倒计时 var times = 60; function waitTime() { if (times == 0) { $("#codeButton").removeAttr("disabled").val("重新获取验证码"); times = 60; } else { $("#codeButton").attr("disabled", true).val("在(" + times + ")秒后重新发送"); times--; setTimeout(function() {waitTime()},1000) } } //Ajax无刷新GET方式 发送验证码 $("#codeButton").on('click',function(){ var telphone=$('#telphone').val(); $.ajax({ type: "GET", url: "XXOO", data: {telphone:telphone}, success: function(data){ waitTime(); } }); });</script></head><body><label>请输入手机号码: <input type="text" id="telphone" name="telphone" /></label><label> <input type="button" id="codeButton" value="获取验证码"/></label><label>请输入验证号码: <input type="text" id="rcode"/></label></body></html>
新闻热点
疑难解答