抢占iPhone7专属预订名额 上市时间同步发售 首批新苹果30个预订专属名额 恭喜提交成功 分享一下,安抚激动的心 $(function(){ //提交表单 $("#activityForm").Validform({ btnSubmit:"#confirm", tiptype:function(msg){ if(msg !=''&& msg!='通过信息验证!'){ alert(msg); } }, tipSweep:true, beforeSubmit:function(){ saveForm(); returnfalse; } }); }); //只允许在APP内打开 functionisMobile(){ varu = navigator.userAgent; varmobileFlag = u.indexOf('type/tfbrowser') > -1; returnmobileFlag; } //手机号码验证 $("#mobilePhone").blur(function(){ varmobilePhone =$("#mobilePhone").val(); varmyreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/; if(mobilePhone){ if(!myreg.test(mobilePhone)){ alert("请输入有效的手机号码!"); $("#mobilePhone").val(""); return; } } }); //发送短信验证码 $("#num").click(function(){ varmobilePhone =$("#mobilePhone").val(); varurl="/wamei/activityController/sendValidCode.htm"; if(!mobilePhone){ alert("请输入您的手机号码!"); return; } varmark = $("#num").attr("mark"); if("1"==mark){ settime(this); $.post(url,{mobilePhone:mobilePhone},function(html){ vardata = eval("("+html+")"); if(data && data.statusCode==1){ console.log("send success!"); alert("短信验证码已发送,请查收!"); }else{ alert(data.msg); } }); } }); //提交form表单 functionsaveForm(){ $("#activityForm").ajaxSubmit({ //data: {'columnStr':columnStr}, type:'post', async:false, success:function($data) { vardata = eval("("+$data+")"); if(data && data.statusCode==1){ $("#success").show(); }else{ alert(data.msg); $("#mobilePhone").val(""); } } }); } $(".close").click(function(){ $("#success").hide(); window.location.reload(); }) //短信后倒计时 varcountdown=60; functionsettime(obj) { if(countdown == 0) { $(obj).attr("disabled",false); $(obj).attr("mark","1"); $(obj).html("获取验证码"); countdown = 60; return; }else{ $(obj).attr("disabled",true); $(obj).attr("mark","0"); $(obj).html("重新发送("+ countdown +")"); countdown--; } setTimeout(function() { settime(obj) } ,1000) } // $("#confirm").click(function(){ // $("#success").show(); // }) |