<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<script src= "Html/js/jquery-1.4.1.min.js" type= "Text/javascript" ></script>
<script type= "Text/javascript" >
var intervalobj; Timer variable, control time
var count = 5; Interval function, 1 second execution
var curcount;//current number of seconds remaining
Function SendMessage () {
Curcount = count;
Set the button effect to start timing
$ ("#btnSendCode"). attr ("Disabled", "true"),
$ ("#btnSendCode"). Val ("please" + Curcount + " Seconds to enter the verification Code ");
Intervalobj = Window.setinterval (setremaintime, 1000);//start timer, 1 seconds to execute once
//Send processing data to background
$.ajax ({
Type: "POS T ",//Post transfer
DataType:" Text ",//Data format: JSON
URL: ' login.ashx ',//Destination address
Data:" dealtype= "+ Dealtype +" &uid= "+ uid +" &code= "+ code,
Error:function (XMLHttpRequest, Textstatus, Errorthrown) {},
Succes S:function (msg) {}
});
}
Timer handler function
function Setremaintime () {
if (Curcount = = 0) {
Window.clearinterval (intervalobj);//Stop Timer
$ ("#btnSendCode"). Removeattr ("Disabled");//Enable button
$ ("#btnSendCode"). Val ("Resend Verification Code");
}
else {
curcount--;
$ ("#btnSendCode"). Val ("Please enter the verification code in" + Curcount + "seconds);
}
}
</script>
<body>
<input id= "Btnsendcode" type= "button" value= "Send verification Code" onclick= "SendMessage ()"/></p>
</body>
jquery implementation of the Click button after the countdown effect, more for the implementation of mobile phone verification Code, email Verification Code