zoukankan      html  css  js  c++  java
  • 短信验证倒计时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>

      

  • 相关阅读:
    var、let、const之间的区别
    es5和es6的区别
    [2020CCPC威海G] Caesar Cipher
    [CF1437E] Make It Increasing
    [CF1437C] Chef Monocarp
    [CF1436D] Bandit in a City
    [CF1418D] Trash Problem
    [CF1419E] Decryption
    [CF1420C2] Pokémon Army (hard version)
    [CF1424M] Ancient Language
  • 原文地址:https://www.cnblogs.com/a757956132/p/4206518.html
Copyright © 2011-2022 走看看