Taobao and other shopping sites, we will see a message to send the Countdown button, on Earth is how to achieve it? Below I will give you a piece of code is very practical.
Nonsense not much said, directly to everyone paste JS code.
* *
120 seconds Mobile phone Short message button Countdown
/exports.sendmessage = function (name) {
var second =;
$ (name). attr ("Disabled", true);
var color = $ (name). CSS (' Background-color ');
$ (name). attr ("style", "Background-color: #c1c1c1");
function Update (num) {
if (num = = second) {
$ (name). attr ("style", "Background-color:" +color);
$ (name). Text ("Get Validation Code");
$ (name). attr ("disabled", false);
else {
var printnr = second-num;
$ (name). Text (Printnr + seconds to get);
}
function Uupdate (i) {return
function () {
update (i);
}
}
for (var i = 1; I <= second i++) {
settimeout (uupdate (i), I * 1000);
}
The above code is this article for you to introduce the JavaScript implementation of mobile phone Short message button countdown all narrative, I hope you like.