This article introduces the jquery countdown timer button SetTimeout example, the need for friends can refer to the
copy code code as follows:
<head runat= "Server" >
<title></title>
<script type= "Text/javascript" src= "Js/jquery-1.3.2.js" ></script>
<script type= "Text/javascript" >
var timeout;
var count = 10; Bottom 10,
.
$ (function () {
timeout = settimeout (btncount, 1000); 1s perform one btncount
});
Btncount = function () {
Start button
if (count = = 0) {
$ (' #btnSubmit '). attr ("Disabled", "");
$ (' #btnSubmit '). Val ("OK");
cleartimeout (timeout); Timeout
set by the settimeout () method can be canceled
}
else {
count--;
$ (' #btnSubmit '). Val ("Definite (" + count.tostring () + ");
settimeout (Btncount, 1000);
}
};
</script>
</head>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:button id= "btnsubmit" runat= "Server" text= "OK" enabled= "false"
onclick= "btnSubmit_Click"/>
</div>
</form>
</body>
The settimeout preset is executed only once, but we can use recursion to start it ourselves.