This article will introduce you to the question that after clicking the button in jquery, the message sending effect can be clicked 60 seconds after the countdown. For details, refer.
Example
The Code is as follows: |
Copy code |
<Input type = "button" id = "btn" value = "get verification code for free"/> <Script type = "text/javascript"> Var wait = 60; Function time (o ){ If (wait = 0 ){ O. removeAttribute ("disabled "); O. value = "get verification code for free "; Wait = 60; } Else { O. setAttribute ("disabled", true ); O. value = "resend (" + wait + ")"; Wait --; SetTimeout (function (){ Time (o) }, 1000) } } Document. getElementById ("btn"). onclick = function () {time (this );} </Script> |
Or write it like this.
The Code is as follows: |
Copy code |
<Input type = "button" id = "btn" value = "get verification code for free" onclick = "settime (this)"/> <Script type = "text/javascript"> Var countdown = 60; Function settime (val ){ If (countdown = 0 ){ Val. removeAttribute ("disabled "); Val. value = "get verification code for free "; Countdown = 60; } Else { Val. setAttribute ("disabled", true ); Val. value = "resend (" + countdown + ")"; Countdown --; } SetTimeout (function (){ Settime (val) }, 1000) } </Script> |
For more information about js countdown, see
The Code is as follows: |
Copy code |
<Script> I = 9 Function change () { I --; P. value = "agree" + I If (I = 0) {P. disabled = false} Else SetTimeout ("change ()", 1000) } Window. onload = change; </Script> <Input type = button name = p disabled> </font> <A href = "http://www.bKjia. c0m/"> enter 111cn </a> |