亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js實(shí)現(xiàn)手機(jī)發(fā)送驗(yàn)證碼功能

 更新時(shí)間:2017年03月13日 11:12:10   作者:18301695170  
本文主要介紹了js實(shí)現(xiàn)手機(jī)發(fā)送驗(yàn)證碼功能的示例。具有很好的參考價(jià)值。下面跟著小編一起來(lái)看下吧

效果圖:

代碼如下:

<!DOCTYPE html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>發(fā)送驗(yàn)證碼倒計(jì)時(shí)功能</title>
<style>
@charset "utf-8";
*{ margin:0; padding:0; list-style:none}
body{ background:#EBECED; font-family:'微軟雅黑'}
.form{width: 450px;height: auto; margin:100px auto; overflow:hidden;font-size: 16px;color: #1b1b1b;text-align: left; padding:50px; border:1px solid #ccc; border-radius:10px;}
.form div{padding:5px 0;overflow: hidden;}
.form label{width: 90px;display: block;float: left;}
.form .infos{width:200px;height: 26px;line-height: 26px;border:1px solid #BFBFBF;padding:2px;border-radius:4px;float: left;}
.form .div-phone a.send1{height: 26px;text-decoration:none;line-height: 26px;padding:2px;width: 80px;background: #AA8926;font-family: '宋體';color: #fff;font-size: 12px;text-align: center;display: block;float: left;border-radius:2px;margin-left:2px;-webkit-transition:all 0.2s linear;-moz-transition:all 0.2s linear;-ms-transition:all 0.2s linear;-o-transition:all 0.2s linear;transition:all 0.2s linear;}
.form .div-phone a.send1:hover{text-decoration: none;background: #866c1b;-webkit-transition:all 0.2s linear;-moz-transition:all 0.2s linear;-ms-transition:all 0.2s linear;-o-transition:all 0.2s linear;transition:all 0.2s linear;}
.form .div-phone a.send0{height: 26px;text-decoration:none;line-height: 26px;padding:2px;width: 80px;background: #A1A1A1;font-family: '宋體';color: #fff;font-size: 12px;text-align: center;display: block;float: left;border-radius:2px;margin-left:2px;}
.form .div-phone a.send0:hover{background: #A1A1A1;font-family: '宋體';color: #fff;font-size: 12px;text-decoration: none;}
.form span.error{height: 26px;line-height: 26px;padding:2px;width: 100px;color: red;padding-left:20px;display: block;float: left;margin-left:10px;font-size: 12px;font-family: '宋體';background: url(../images/error.png) no-repeat left center;}
.form #phone{width: 116px;}
.form .div-conform{padding-right:153px;}
.form .div-conform a.conform{width: 136px;height: 34px;display: block;text-align: left;overflow: hidden;background: url(../images/btn.jpg) no-repeat;float: right;text-indent: -1000px;}
</style>
</head>
<body>
<!--代碼部分begin-->
<div class="form">
 <div class="div-name">
 <label for="name">用戶名</label><input type="text" id="name" class="infos" placeholder="請(qǐng)輸入用戶名" />
 </div>
 <div class="div-phone">
 <label for="phone">手機(jī)</label><input type="text" id="phone" class="infos" placeholder="請(qǐng)輸入手機(jī)" />
 <a href="javascript:;" rel="external nofollow" rel="external nofollow" class="send1" onclick="sends.send();">發(fā)送驗(yàn)證碼</a>
 </div>
 <div class="div-ranks">
 <label for="ranks">驗(yàn)證碼</label><input type="text" id="ranks" class="infos" placeholder="請(qǐng)輸入驗(yàn)證碼" />
 </div>
 <div class="div-conform">
 <a href="javascript:;" rel="external nofollow" rel="external nofollow" class="conform" onclick="sends.conform();">提交</a>
 </div>
</div>
<script src="http://www.lanrenzhijia.com/ajaxjs/jquery.min.js"></script>
<script>
var sends = {
 checked:1,
 send:function(){
  var numbers = /^1\d{10}$/;
  var val = $('#phone').val().replace(/\s+/g,""); //獲取輸入手機(jī)號(hào)碼
  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">手機(jī)格式錯(cuò)誤</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("發(fā)送驗(yàn)證碼");
   sends.checked = 1;
   return true;
   }
   $('.div-phone a').html(time+"S后再次發(fā)送");
   time--;
   return false;
   sends.checked = 0;
  }
  $('.div-phone a').addClass('send0').removeClass('send1');
  timeCountDown();
  var timer = setInterval(timeCountDown,1000);
  }
 }
}
</script>
</body>
</html>

以上就是本文的全部?jī)?nèi)容,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來(lái)一定的幫助,同時(shí)也希望多多支持腳本之家!

相關(guān)文章

  • 動(dòng)態(tài)統(tǒng)計(jì)當(dāng)前輸入內(nèi)容的字節(jié)、字符數(shù)的實(shí)例詳解

    動(dòng)態(tài)統(tǒng)計(jì)當(dāng)前輸入內(nèi)容的字節(jié)、字符數(shù)的實(shí)例詳解

    這篇文章主要介紹了動(dòng)態(tài)統(tǒng)計(jì)當(dāng)前輸入內(nèi)容的字節(jié)、字符數(shù)的實(shí)例詳解的相關(guān)資料,希望通過(guò)本文能幫助到大家,讓大家實(shí)現(xiàn)這樣的功能,需要的朋友可以參考下
    2017-10-10
  • 純js的右下角彈窗實(shí)例

    純js的右下角彈窗實(shí)例

    下面小編就為大家?guī)?lái)一篇純js的右下角彈窗實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-03-03
  • laydate如何根據(jù)開(kāi)始時(shí)間或者結(jié)束時(shí)間限制范圍

    laydate如何根據(jù)開(kāi)始時(shí)間或者結(jié)束時(shí)間限制范圍

    這篇文章主要為大家詳細(xì)介紹了laydate根據(jù)開(kāi)始時(shí)間或者結(jié)束時(shí)間限制范圍的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-11-11
  • js跳轉(zhuǎn)頁(yè)面方法總結(jié)

    js跳轉(zhuǎn)頁(yè)面方法總結(jié)

    本篇文章主要是對(duì)js跳轉(zhuǎn)頁(yè)面方法進(jìn)行了詳細(xì)的總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2014-01-01
  • 原生JavaScript實(shí)現(xiàn)九宮格抽獎(jiǎng)

    原生JavaScript實(shí)現(xiàn)九宮格抽獎(jiǎng)

    這篇文章主要為大家詳細(xì)介紹了原生JavaScript實(shí)現(xiàn)九宮格抽獎(jiǎng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-06-06
  • jquery+css3實(shí)現(xiàn)網(wǎng)頁(yè)背景花瓣隨機(jī)飄落特效

    jquery+css3實(shí)現(xiàn)網(wǎng)頁(yè)背景花瓣隨機(jī)飄落特效

    在qq空間可以自定義一些插件,裝飾空間,大家通常就是復(fù)制代碼到空間粘貼,會(huì)實(shí)現(xiàn)非常美觀的效果,有的會(huì)隨機(jī)飄落一些花瓣,那么這種效果用代碼怎么實(shí)現(xiàn)的呢,下面小編給大家詳解jquery實(shí)現(xiàn)網(wǎng)頁(yè)背景花瓣隨機(jī)飄落特效,需要的朋友可以參考下
    2015-08-08
  • javascript數(shù)組拍平方法總結(jié)

    javascript數(shù)組拍平方法總結(jié)

    本篇文章給大家詳細(xì)分析了javascript數(shù)組拍平的方法,對(duì)此有興趣的朋友跟著小編一起學(xué)習(xí)下吧。
    2018-01-01
  • JS中操作JSON總結(jié)

    JS中操作JSON總結(jié)

    本篇文章主要是對(duì)JS操作JSON進(jìn)行了總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2014-02-02
  • console.log的輸出語(yǔ)句如何使用

    console.log的輸出語(yǔ)句如何使用

    這篇文章主要介紹了關(guān)于console.log的輸出語(yǔ)句如何使用問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-02-02
  • JS實(shí)現(xiàn)百度搜索框

    JS實(shí)現(xiàn)百度搜索框

    這篇文章主要為大家詳細(xì)介紹了JS實(shí)現(xiàn)百度搜索框,實(shí)時(shí)返回搜索建議項(xiàng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-02-02

最新評(píng)論