<p >
<label><em>*</em>手机号 </label>
<span><input type="text" id="phone" name="phone" class="text" value="" maxlength="50" datatype="phone" placeholder="请输入您的手机号码码" nullmsg="请输入您的手机号码码" errormsg="手机格式不正确"/></span> </p><p>
<label><em>*</em> 短信验证码 </label>
<span> <input id="mesNum" name="mesNum" type="text" class="text w270" datatype="*" nullmes="请填写短信验证码" placeholder="请输入短信验证码" /> <button class="verifyCode" id="verifyCode">获取短信验证码</button> </span> </p>///短信验证码
var countdown=60; var interval; $("#verifyCode").click(function(){ var thisbtn=$(this); var phone=$("#phone").val(); $.ecp.remoteService.ajax4Bean({ beanId: "com.cloud.login.service.impl.CustomerAuthRS.queryPhoneMsgCode()", data: { phone:phone , }, success: function(resdata, textStatus, jqXHRult){ if(phone==""||phone==null||phone==undefined){new UINotify("请输入手机号码 ").show();} else if(!/^1\d{10}$/.test(phone)){new UINotify("手机号格式不正确").show();} else{ if(JSON.parse(resdata.resultObj)['retCode']=="000000"){ new UINotify("短信发送成功,请注意收集").show(); interval=setInterval(function() { settime(); } ,1000); } else{//手机接收验证码达到上限 new UINotify(JSON.parse(resdata.resultObj)['retDesc']).show(); } } } }); }) function settime() { if(countdown == 0) { $("#verifyCode").removeAttr("disabled").css("background-color","#f5f5f5").html("短信验证码"); countdown = 60; clearInterval(interval); } else { $("#verifyCode").attr("disabled","disabled").css("background-color","#b3b3b3").html("重新发送" countdown 's'); countdown--; } }