短信验证倒计时60s

短信验证倒计时60s

		$("#zphone").click(function(){
var tel2 = $("#regTel").val();
if(flag.tel){
$.post(
"<%=path%>/main/login_regCode.action",
{"tel":tel2},
function(data){
if(data){
if(data == "has"){
RemainTime();
}
}
}
);
return false;
}else{
alert("必须为移动用户!");
} }); var iTime = 59;
var Account;
function RemainTime(){
document.getElementById('zphone').disabled = true;
var iSecond,sSecond="",sTime="";
if (iTime >= 0){
iSecond = parseInt(iTime%60);
iMinute = parseInt(iTime/60);
if (iSecond >= 0){
if(iMinute>0){
sSecond = iMinute + "分" + iSecond + "秒";
}else{
sSecond = iSecond + "秒";
}
}
sTime=sSecond;
if(iTime==0){
clearTimeout(Account);
sTime='获取手机验证码';
iTime = 59;
document.getElementById('zphone').disabled = false;
}else{
Account = setTimeout("RemainTime()",1000);
iTime=iTime-1;
}
}else{
sTime='没有倒计时';
}
document.getElementById('zphone').value = sTime; if(iTime == 0){
alert("验证码超时!");
}
} 界面:
<li>
<label>验 证 码:
<input type="text" name="code" class="ipt" id="regCode"/>
<input type="submit" id="zphone" value="发送验证码" class="submitBtn1" />
<font color="#ff0000">* 不能为空</font>
</label>
</li>

  

上一篇:Windows 记事本的 ANSI、Unicode、UTF-8 这三种编码模式有什么区别?


下一篇:UVa 12096 (STL) The SetStack Computer