jquery implementation of the Click button after the countdown effect, more for the implementation of mobile phone verification Code, email Verification Code

Source: Internet
Author: User

Original link: http://www.cnblogs.com/steed-zgf/archive/2012/02/03/2336984.html

<! DOCTYPE HTML Public"-//W3C//DTD XHTML 1.0 transitional//en""Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"Http://www.w3.org/1999/xhtml">"Html/js/jquery-1.4.1.min.js"Type="Text/javascript"></script><script type="Text/javascript">var intervalobj;//Timer variable, control timevar count =5;//Interval function, 1 second executionvar Curcount;//Current number of seconds remainingfunction SendMessage () {Curcount =Count//Set the button effect to start the timer $ ("#btnSendCode"). attr ("Disabled","True"); $("#btnSendCode"). Val ("Please check the"+ Curcount +"Enter the verification code in seconds"); Intervalobj = Window.setinterval (Setremaintime,1000);//Start Timer, execute once in 1 seconds//Send processing data to the background$.ajax ({type:"POST",//To transmit dataType by post:"Text",//Data format: JSON URL:‘Login.ashx‘,//Destination Address data:"Dealtype="+ Dealtype +"&uid="+ UID +"&code=" +Code, Error:function (XMLHttpRequest, Textstatus, Errorthrown) {}, Success:function (msg) {}});//Timer handler functionfunction Setremaintime () {if (Curcount = =0) {window.clearinterval (intervalobj);//Stop Timer $ ("#btnSendCode"). Removeattr ("Disabled");//Enable Button $ ("#btnSendCode"). Val ("Resend Verification Code");}Else{curcount--; $(" #btnSendCode  "). Val (   seconds Enter the verification code  " " btnsendcodebutton "Value=  Send verification code  "Onclick="  SendMessage ()  "/></P></BODY></HTML>     

jquery implementation of the Click button after the countdown effect, more for the implementation of mobile phone verification Code, email Verification Code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.