Usually the registration page will have to get the Code button, and then click After 60 seconds to regain, such as now encountered in the project
Then click on the style, and the number is decremented, to 0 o'clock back to the original state ().
Construct the HTML structure first
<button class= "GetCode" > Get Verification Code </button>
CSS is a little bit
JS implementation:
var wait=60; function Time (o) { if (wait==0) { o.removeattribute ("Disabled"); O.innerhtml= "Input verification Code"; O.style.backgroundcolor= "#fe9900"; wait=60; } else{ o.setattribute ("disabled", true); o.innerhtml=wait+ "re-fetch after second"; O.style.backgroundcolor= "#8f8b8b"; wait--; SetTimeout (function () {Time (o) },1000) } }
Finally, click the button and call the time method:
$ (". GetCode"). Click (function () {Time (this); });
At this point all functions are complete.
JS Implementation Verification Code Countdown effect