<div class= "Input-group-addon" ><a style= "width:100%;height:100%" href= "Javascript:xiaoyuelogin ();" Id= " Verbtn "> Get Verification Code </a></div>
<Script> varintervalobj;//timer variable, control time varCount= -; //interval function, 1 second execution varCurcount;//current number of seconds remaining $(function () { $("#verbtn"). Click (function () {}) $("#lkchage"). Click (function () { varMobile=$("#nickname"). Val (); varver= $("#reg_verify"). Val (); if(ver=="") {alert ("The verification code cannot be empty"); return; } $.post ("/ucenter/member/foundpassword", {mobile:mobile,reg_verify:ver},function(data) {Console.log (data); alert (data.msg); Location.href="/ucenter/member/login.html"; }) }) }) functionXiaoyuelogin () {varMobile=$("#nickname"). Val (); varReg= /^0?1[3|4|5|8][0-9]\d{8}$/; if(!mobile) {Alert ('The phone number cannot be empty'); return false; } if (!reg.test (MOBILE)) {Alert ('cell phone number format is not correct'); return false; } Curcount=count; $("#verbtn"). Removeattr ("href"); $("#verbtn"). HTML ("Verification Code (" +Curcount+ ")"); Intervalobj=Window.setinterval (Setremaintime, +); //start Timer, execute once in 1 seconds$.get ("/mob/message/sendsms?action=1&mobile="+Mobile,function(data) {alert (data.msg); Console.log (Data.code); if(Data.code== 1){} }) } functionSetremaintime () {if(Curcount== 0) {window.clearinterval (intervalobj);//Stop Timer $("#verbtn"). attr ("href", "Javascript:xiaoyuelogin ();"); $("#verbtn"). HTML ("Resend Verification Code"); } Else{Curcount--; $("#verbtn"). HTML ("Verification Code (" +Curcount+ ")"); } } </Script>
Countdown, text message sent after the countdown effect JS