SMS Verification Code countdown can be very good to avoid frequent user access, usually using the JS implementation to obtain SMS Verification code countdown function, the specific implementation of the following:
HTML section:
Page effect:
JS section:
<script>var btndisable = false; Whether the Send button disables Var Btn=document.getelementbyid ("Snsbtn"); Button DOM Object Btn.onclick=function () {//button click event//Prevent wait period execution send if (btndisable) { return; } 1, execute the Request verification code logic //.... 2, set timer and so on timewait ( 3), Recovery button available btndisable = true;} function (time) { setTimeout () { if (time>=0) { btn.innerhtml = time + "s after retry"; time--; Timewait (time); } else{ btn.innerhtml = "send"; btndisable = false; } },1000); Set Timer }</script>
Final implementation effect
Reproduced in this article: http://www.lx598.com/hangyedongtai/1028.html
JS implementation to send SMS Verification Code Countdown tutorial