jquery implementation of the phone sent verification code countdown effect code sharing

Source: Internet
Author: User

This is a jquery based on the implementation of the mobile phone verification Code countdown effect codes, to achieve real-time display seconds Countdown function, but also to achieve the function of mobile phone number format verification, is a common website registration to send mobile phone verification code effect code.

Effect Description:
Register a website, when need to send verification code to the phone, we often encounter this effect:
First detect whether the phone conforms to 1 beginning, 11-digit format;
If not, the error message is indicated and false is returned;
Otherwise submitted to the background, the background is determined to return a value after receiving, send button gray and countdown.

Operating effect:

annual interest rate up to 14.4%Shanghai Investment and financial management, 200,000 investment, annual income of 14.4% real estate mortgage, wind control guarantee

--------------------------------effect Demo Source Download--------------------------------

For everyone to share the jquery implementation of the mobile phone to send verification codes countdown effect code as follows

?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jQuery手机发送验证码倒计时代码</title><link href="css/jb51.css" type="text/css" rel="stylesheet" /></head><body><div class="form"> <div class="div-name"> <label for="name">用户名</label><input type="text" id="name" class="infos" placeholder="请输入用户名" /> </div> <div class="div-phone"> <label for="phone">手机</label><input type="text" id="phone" class="infos" placeholder="请输入手机" /> <a href="javascript:;" class="send1" onclick="sends.send();">发送验证码</a> </div> <div class="div-ranks"> <label for="ranks">验证码</label><input type="text" id="ranks" class="infos" placeholder="请输入验证码" /> </div> <div class="div-conform"> <a href="javascript:;" class="conform" onclick="sends.conform();">提交</a> </div></div><script src="js/jquery-1.8.3.min.js"></script><script>var sends = { checked:1, send:function(){  var numbers = /^1\d{10}$/;  var val = $(‘#phone‘).val().replace(/\s+/g,""); //获取输入手机号码  if($(‘.div-phone‘).find(‘span‘).length == 0 && $(‘.div-phone a‘).attr(‘class‘) == ‘send1‘){  if(!numbers.test(val) || val.length ==0){   $(‘.div-phone‘).append(‘<span class="error">手机格式错误</span>‘);   return false;  }  }  if(numbers.test(val)){  var time = 30;  $(‘.div-phone span‘).remove();  function timeCountDown(){   if(time==0){   clearInterval(timer);   $(‘.div-phone a‘).addClass(‘send1‘).removeClass(‘send0‘).html("发送验证码");   sends.checked = 1;   return true;   }   $(‘.div-phone a‘).html(time+"S后再次发送");   time--;   return false;   sends.checked = 0;  }  $(‘.div-phone a‘).addClass(‘send0‘).removeClass(‘send1‘);  timeCountDown();  var timer = setInterval(timeCountDown,1000);  } }}</script></body></html>

The above is for everyone to share the jquery implementation of the mobile phone to send verification code countdown effect code, I hope you can like.

Articles you may be interested in:
    • jquery Implementation Countdown function
    • jquery Simple Countdown Implementation method
    • jquery implements countdown to merchandise activity
    • Using jquery to achieve beautiful round progress bar Countdown Plugin
    • Online test countdown to prevent refreshes based on the Jquery+cookie implementation
    • How to achieve the countdown effect of jquery Group purchase
    • jquery Imitation Millet Phone snapping page countdown effect
    • jquery Implementation Countdown button function code share
    • jquery Countdown source Sharing
    • Examples of jquery implementation countdown jumps
    • jquery implements a countdown code for the phone to send a verification code
    • A summary of the countdown effect of jquery implementation

jquery implementation of the phone sent verification code countdown effect code sharing

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.