标签:
<script type="text/javascript"> $(function(){ $("#sendSms").click(function(){ sendSms(); } ); // 手机和21cake地址切换 var $menu_li = $(".banner li"); $menu_li.click(function(){ $(this).addClass(‘link‘).siblings().removeClass("link"); var index = $menu_li.index(this); $(".frame_content>div").eq(index).show().siblings().hide(); }); //发送验证码 function sendSms() { var mobile = $("#mobile").val(); if (mobile == "") { Dialog.toast("手机号码不能为空"); return false; } if (mobile.length != 11) { Dialog.toast(‘手机号错误,请填写正确的手机号码!‘); return; } if (!/^(1)\d{6,10}$/.test(mobile)) { Dialog.toast(‘手机号错误,请填写正确的手机号码!‘); return; } $("#sendSms").attr("disabled","true"); $.ajax({ ‘type‘ : "POST", ‘url‘ : "/sendSms", ‘data‘ : {‘mobile‘:mobile}, ‘dataType‘:‘json‘, ‘success‘ : function(response) { Dialog.toast(response); var maxtime = 60; timer = setInterval(function(){ if(maxtime>=0){ msg="("+maxtime+")重新发送"; --maxtime; $("#sendSms").text(msg); $("#sendSms").attr("style","background-color:#fff;color:#b3b3b3;width:30%"); }else{ clearInterval(timer); msg="发送验证码"; maxtime=60; $("#sendSms").removeAttr("disabled"); $("#sendSms").text(msg); $("#sendSms").attr("style","background-color:#383838;color:#fff;width:28%"); } },1000); }, ‘error‘ : function(XMLHttpRequest){ var a = JSON.parse(XMLHttpRequest.response); $("#sendSms").removeAttr("disabled"); Dialog.toast(a.message); } }); } //手机号快捷登录注册 $(‘#register_btn‘).on(‘click‘,function(){ var validate_code = $("#validate_code").val(); var mobile = $("#mobile").val(); var login_form = $("#tellogin"); if(validate_code == ""){ Dialog.toast(‘验证码不能为空‘); return false; } if(mobile == ""){ Dialog.toast(‘手机号不能为空‘); return false; } $.ajax({ ‘type‘ : "POST", ‘url‘ : "/login", ‘data‘ : login_form.serialize(), ‘dataType‘:‘json‘, ‘success‘ : function(response) { window.location.href = response.redirect_url; }, ‘error‘ : function(XMLHttpRequest){ var a = JSON.parse(XMLHttpRequest.response); Dialog.toast(a.message); } }); }); //21cake 账号、密码登录 $(‘#cake_login‘).on(‘click‘,function(){ var account = $("#account").val(); var password = $("#password").val(); var login_form = $("#cakelogin"); if(account == ""){ Dialog.toast(‘登录名不能为空‘); return false; } if(password == ""){ Dialog.toast(‘密码不能为空‘); return false; } $.ajax({ ‘type‘ : "POST", ‘url‘ : "/login/cake", ‘data‘ : login_form.serialize(), ‘dataType‘:‘json‘, ‘success‘ : function(response) { window.location.href = response.redirect_url; }, ‘error‘ : function(XMLHttpRequest){ var a = JSON.parse(XMLHttpRequest.response); Dialog.toast(a.message); } }); }); }); </script> <script src="/resource/js/analysis.js"></script> <script> $track_domain = "http://t.test.join10.com"; analysis.page(50); // 个人中心 与 订单确认 地址定位 $(‘#mobile‘).blur(function(){ if($(this).val().length > 0) { analysis.button(50);// 手机号输入 } }); $(‘#sendSms‘).click(function(){ analysis.button(51);// 验证码点击 }); $(‘#validate_code‘).blur(function(){ if($(this).val().length > 0) { analysis.button(52);// 验证码输入 } }); $(‘#register_btn‘).click(function(){ analysis.button(53);// 验证并登陆点击 }); $(‘#account‘).blur(function(){ if($(this).val().length > 0) { analysis.button(54);// 帐号输入 } }); $(‘#password‘).blur(function(){ if($(this).val().length > 0) { analysis.button(55);// 密码输入 } }); $(‘#cake_login‘).click(function(){ analysis.button(56);// 登陆点击 }); </script>
标签:
原文地址:http://www.cnblogs.com/xupeiyu/p/5200474.html