傳送簡訊倒計時(附帶資料驗證) 乾貨

2021-09-28 18:00:07 字數 3102 閱讀 4186

/*

獲取驗證碼

*/$("#sendcode").click(function

() ;

if(data.mobile == "" || data.mobile.length != 11)

else

else

if(data.result.statuscode == 0)

else

}});}})

var wait = 60;

function

time(o)

else

, 1000)

}}

var locks = 5;

function

locktime(o)

else

, 1000)

}}

頁面結構

<

div

class

="main-content"

style

="">

<

div

class

="warp"

>

<

div

class

="regist"

>

<

h2>註冊

h2>

<

form

id="registform"

>

<

div

class

="form-cont"

>

<

input

class

="ismobilephone"

id="mobile"

name

="mobile"

type

="tel"

placeholder

="請輸入手機號"

required

/>

div>

<

div

id="errormassage"

class

="error-massage"

>

div>

<

div

class

="form-cont clearfix"

>

<

input

class

="vcode"

name

="vcode"

type

="text"

placeholder

="請輸入驗證碼"

required

/><

input

id="getvcode"

class

="btn"

type

="button"

value

="獲取驗證碼"

/>

div>

<

div

class

="form-cont"

>

<

input

id="password"

name

="password"

type

="password"

placeholder

="設定密碼"

required

/>

div>

<

div

class

="check-password"

>

<

span

>簡單

span

><

span

>一般

span

><

span

>複雜

span

>

div>

<

div

class

="form-cont"

>

<

input

name

="lastpassword"

type

="password"

placeholder

="確認密碼"

required

/>

div>

<

div

class

="form-cont"

>

<

label

id="agreement"

class

="selected-bg"

for="che"

><

input

id="che"

class

="che"

type

="checkbox"

checked

="checked"

/>

label

><

span

>我已閱讀並接受 <

a id

="protocol"

href

="">《隱私與服務協議》

a>

span

>

div>

<

div>

<

input

id="sunminbtn"

class

="register-btn"

type

="button"

value

="立即註冊"

/>

div>

form

>

div>

<

div

class

="imgdown"

>

<

img

src="img/iconbar.png"

/>

div>

div>

div>

更多專業前端知識,請上

【猿2048】www.mk2048.com

傳送簡訊按鈕倒計時

1,定時器執行的函式 js var smsbtntiming function else 2,傳送請求,並且操作成功後才執行倒計時 js ajax success function data else else settimeout restorespanhit,4000 settimeout re...

獲取簡訊驗證碼倒計時

我用的是谷歌自帶的類 countdowntimer 直接看用法 private countdowntimer timer new countdowntimer 60000 300,1000 override public void onfinish countdowntimer自帶倆個方法 onti...

驗證碼倒計時

獲取驗證碼倒計時功能 1 布局檔案中就是乙個按鈕獲取驗證碼 id btnsms android layout width 120dp android layout height 50dp android layout marginright 5dp android background color ...