Copy Code code as follows:
<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); The timeout set by the settimeout () method can be canceled
}
else {
count--;
$ (' #btnSubmit '). Val ("Definite" ("+ count.tostring () +");
SetTimeout (Btncount, 1000);
}
};
</script>
<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.