Click the button countdown 60 seconds before you can click the JS code sent

Source: Internet
Author: User

The content of this section:
Javascript implements the Click button Countdown 60 seconds before you can click the effect of the send again.

For example, some websites on the mobile phone message authentication function, there is similar to implement the Click button, countdown 60 seconds to click the effect of sending again.

This article uses JavaScript to implement the Click button, countdown 60 seconds to re-click the ability to send verification code.

Example:

Copy Code code example:

<input type= "button" id= "btn" value= "Get Verification Code free"/>
<script type= "Text/javascript" >
var wait=60;
function Time (o) {
if (wait = = 0) {
O.removeattribute ("Disabled");
O.value= "Free access to verification code";
wait = 60;
} else {//www.jbxue.com
O.setattribute ("Disabled", true);
O.value= "Resend (" + Wait + ")";
wait--;
SetTimeout (function () {
Time (O)
},
1000)
}
}
document.getElementById ("Btn"). Onclick=function () {time (this);}
</script>


< /span>

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.