When sending the short message verification code, you need to use js to set the reverse order of time. Sometimes it will cause js failure. What should I do? Today, I want to share with you a solution to the problem of invalid JS setup time. For more information, refer to the following: js setup time reverse order is required when sending the short message verification code, which sometimes leads to js failure, what should we do? Today, I will share with you how to solve the invalid JS time setting problem. For more information, see.
When sending the short message verification code, you need to use js to set the reverse order of time. Sometimes this conventional writing method will cause js to fail. You have tried many methods to find the problem, probably because the js version is too low.
setTimeout(showT(t-1),5000)
Solution:
setTimeout(function(){showT(t-1)},1000)
Or:
setTimeout("Talert(i)",5000);
Jquery code: You must use input to set the value so that jquery can be used to change the value.
<
Var t = 120; showT (t); function showT (t) {if (t> 0) {$ (". sjyzm-btn "). val (t + "Sec"); setTimeout (function () {showT (t-1)}, 1000) // setTimeout (showT (t-1), 5000) // $ ('. sjyzm-btn '). attr ("disabled", true);} else {$ (". sjyzm-btn "). val ("SMS Verification"); // $ (". sjyzm-btn "). removeAttr ("disabled ");}}
The above is a solution to the problem of invalid JS time setting described by the editor. I hope it will be helpful to you. If you have any questions, please leave a message and the editor will reply to you in time. I would like to thank you for your support for PHP chinnet!
For more articles about how to solve the invalid JS setting time, please follow the PHP Chinese network!