手機號獲取驗證碼、驗證驗證碼是否正確


}else {
  alert("驗證碼已發送,請注意查收");
  time();//調用驗證碼倒計時
  document.getElementById('iputCode').setAttribute('class',result);//讓該元素添加calss
}

 

/**
* 點擊獲取驗證碼后顯示倒數時間
*/
var wait = 60;// 定義短信發送倒計時時間
function time(){
  ocument.getElementById('obtain').disabled = false; //讓按鈕可以點擊
  if(wait == 0) {
    document.getElementById('obtain').removeAttribute("disabled"); // 控制按鈕可點擊
    document.getElementById('obtain').value = "獲取驗證碼";
    document.getElementById('obtain').style.color = '#2C8FFF';
    wait = 60; //還原倒計時
  }else{
    document.getElementById('obtain').setAttribute("disabled", true);//控制按鈕不可點擊
    document.getElementById('obtain').value = "重新發送(" + wait + ")";
    document.getElementById('obtain').style.color = '#C0BBBB';
    wait--;
    setTimeout('time()', 1000) //循環調用 
  }
}

 

/**
* 驗證驗證碼是否正確
*/
function verify() {
  var yzm = document.getElementById('iputCode').value; // 獲取注冊用戶填寫的驗證碼
  var yzmtwo = document.getElementById('iputCode').className; // 系統發送的驗證碼
  if (yzm == ""){
    alert("驗證碼不能為空");
    return false;
  }else if (yzm != yzmtwo){
    alert("驗證碼錯誤,請重新輸入!");
    eturn false;
  }
    return true;
}

//點擊下一步驗證驗證碼是否正確

$(function(){

  //下一步
  $('#nextStep').click(function(){
    var ipone = isIpone($('#loginPhone').val());//手機號驗證
    var loginPhone = document.getElementById('loginPhone').value;// 獲取用戶手機號碼

    if(ipone != true){
      return;
    }
    var yzm = verify();//此處調用驗證方法
    if(yzm != true){
      return;
    }
    if(ipone == true && yzm == true) {
      // 下一步跳轉設置密碼頁面 
      window.open('resetPassword.html?iphone='+loginPhone) 
    }
  })

})


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM