var smsyy = document.getElementById("smsyy").value; //发送短信出发语音限制 var ztime =document.getElementById("ztime").value;//倒计时 function getverifycode1(field_id, field_name) { // var chk_reg=register(1); // if(!chk_reg){ // return false; // } var frm = document.forms['formUser']; var mobile = Utils.trim(frm.elements[field_id].value); var smscode = Utils.trim(frm.elements["sms_code"].value); if(mobile == '') { swal("- "+field_name+" 不能為空!"); $(field_id).focus(); return; } /* if(!frm.elements["captcha"]){ swal("請開啟圖形驗證碼功能(系统设置-验证码管理-勾选新用户注册-保存设置)!"); return; } var captcha = Utils.trim(frm.elements["captcha"].value); if(captcha!=''){ smscode = captcha ;//取消了随机码,改为图形验证码 }else{ swal("驗證碼不能為空!"); return; } */ // if(smsyy==-1 || parseInt(smsyy)>0){ Ajax.call('sms.php?step=getverifycode1&r=' + Math.random(), 'mobile=' + mobile+'&smscode=' + smscode, getverifycode1Response, 'POST', 'JSON'); // }else if(parseInt(smsyy)==0){ // Ajax.call('sms.php?step=getverifycode2&r=' + Math.random(), 'mobile=' + mobile+'&smscode=' + smscode, getverifycode2Response, 'POST', 'JSON'); // } } function getverifycode2() { var frm = document.forms['formBindmobile']; var mobile = Utils.trim(frm.elements["mobile"].value); var smscode = Utils.trim(frm.elements["smscode"].value); if(mobile == '') { swal("手機號不能為空!"); $("mobile").focus(); return; } Ajax.call('sms.php?step=getverifycode2&r=' + Math.random(), 'mobile=' + mobile+'&smscode=' + smscode, getverifycode2Response, 'POST', 'JSON'); } function getverifycode1Response(result) { if (result.error==0){ smsyy--; //发送次数 RemainTime(); } if (result.error==0){ var rtype='success'; }else{ var rtype='warning'; } swal({ title: '', type: rtype, text: result.message }); } function getverifycode2Response(result) { if (result.error==0){ RemainTime(); } swal(result.message); } var iTime = parseInt(ztime)-1; var Account; function RemainTime(){ document.getElementById('zphone').style.pointerEvents = 'none'; //document.getElementById('zphone').disabled = true; $('#zphone').css('color','red'); var iSecond,sTime=""; if (iTime >= 0){ iSecond = parseInt(iTime%60); iMinute = parseInt(iTime/60) if (iSecond >= 0){ if(iMinute>0){ sSecond = iMinute + "分" + iSecond + "秒"; }else{ sSecond = iSecond + "秒"; } } sTime=sSecond; if(iTime==0){ clearTimeout(Account); sTime ="取得手機驗證碼"; iTime = parseInt(ztime)-1; //$('#zphone').on('click'); document.getElementById('zphone').style.pointerEvents = 'auto'; $('#zphone').css('color',''); }else{ Account = setTimeout("RemainTime()",1000); iTime=iTime-1; } }else{ sTime='沒有倒數計時'; } document.getElementById('zphone').innerHTML = sTime; }