var this_url = window.location.href; var regemail = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; var regtelphone = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/; var regnum = /^\d+$/; var regPcode = /^\d{6}$/; var regUrl = /^(http|https):\/\/(.+?)\.(.+)/; function getValue(obj) { return $.trim($(obj).val()); } function IsNum(obj, obj2) { if (!regnum.test($(obj).val())) { $(obj).val(obj2); } } $(function () { $('.isNum').keyup(function () { IsNum(this, 1); }); }); var required = function () { var goon = true;//鏄惁缁х画寰幆 var IsRunReg = false;//鏄惁鎵ц姝e湪楠岃瘉 $('.get:visible').map(function () { if (goon) { IsRunReg = false; var val = getValue($(this)); var placeholder = $(this).attr('placeholder'); if ($(this).hasClass('required')) { if (val.length == 0 || $(this).val() == placeholder) { if (placeholder != '' && placeholder != undefined) { alert(placeholder); } else { alert('璇疯緭鍏ュ繀濉俊鎭?'); } if($(this).attr('name') != 'text4'){ $(this).focus(); } goon = false; } else if (val.length == 1 && val == "0") { var placeholder = $(this).attr('placeholder'); if (placeholder != '') { alert(placeholder); } else { alert('璇疯緭鍏ュ繀濉俊鎭?'); } $(this).focus(); goon = false; } IsRunReg = true; } if (!goon) { return false; } if (!IsRunReg) { if (val != undefined && val.length > 0 && val != placeholder) { IsRunReg = true; } } if ($(this).hasClass('tel')) { if (IsRunReg&&!regtelphone.test($(this).val())) { alert('鎮ㄨ緭鍏ョ數璇濈殑鏍煎紡閿欒!'); $(this).focus(); goon = false; } } else if ($(this).hasClass('email')) { if (IsRunReg && !regemail.test($(this).val())) { alert('鎮ㄨ緭鍏ラ偖绠辩殑鏍煎紡閿欒!'); $(this).focus(); goon = false; } } else if ($(this).hasClass('idcard')) { if (IsRunReg && cardValid($(this).val())!='0') { alert('鎮ㄨ緭鍏ョ殑韬唤璇佸彿鐮佷笉姝g‘!'); $(this).focus(); goon = false; } } else if ($(this).hasClass('postalcode')) { if (IsRunReg && !regPcode.test($(this).val())) { alert('鎮ㄨ緭鍏ョ殑閭斂缂栫爜鏍煎紡涓嶆纭?'); $(this).focus(); goon = false; } } else if ($(this).hasClass('number')) { if (IsRunReg && !regnum.test($(this).val())) { alert('鎮ㄨ緭鍏ョ殑涓嶆槸姝f暣鏁?'); $(this).focus(); goon = false; } if (IsRunReg && $(this).attr('min')) { if (Number($(this).val().length) < Number($(this).attr('min'))) { alert('鎮ㄨ緭鍏ョ殑鍊艰繃灏?'); $(this).focus(); goon = false; } } if (IsRunReg && $(this).attr('max')) { if (Number($(this).val().length) > Number($(this).attr('max'))) { alert('鎮ㄨ緭鍏ョ殑鍊艰繃澶?'); $(this).focus(); goon = false; } } } else if ($(this).hasClass('weburl')) { if (IsRunReg && !regUrl.test($(this).val())) { alert('鎮ㄨ緭鍏ョ殑缃戝潃鏍煎紡涓嶆纭?'); $(this).focus(); goon = false; } } } }); return goon; } eval(function (p, a, c, k, e, r) { e = function (c) { return (c < 62 ? '' : e(parseInt(c / 62))) + ((c = c % 62) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if ('0'.replace(0, e) == 0) { while (c--) r[e(c)] = k[c]; k = [function (e) { return r[e] || e }]; e = function () { return '[579bcefhjl-wyzA-F]' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('function cardValid(s){7 t={11:"鍖椾含",12:"澶╂触",13:"娌冲寳",14:"灞辫タ",15:"鍐呰挋鍙?,21:"杈藉畞",22:"鍚夋灄",23:"榛戦緳姹?,31:"涓婃捣",32:"姹熻嫃",33:"娴欐睙",34:"瀹夊窘",35:"绂忓缓",36:"姹熻タ",37:"灞变笢",41:"娌冲崡",42:"婀栧寳",43:"婀栧崡",44:"骞夸笢",45:"骞胯タ",46:"娴峰崡",50:"閲嶅簡",51:"鍥涘窛",52:"璐靛窞",53:"浜戝崡",54:"瑗胯棌",61:"闄曡タ",62:"鐢樿們",63:"闈掓捣",64:"瀹佸",65:"鏂扮枂",71:"鍙版咕",81:"棣欐腐",82:"婢抽棬",91:"鍥藉"};7 l=0;7 5=s;7 u=5.v;9(!/^\\d{17}(\\d|x)$/i.w(5)&&!/^\\d{15}$/i.w(5)){b 1}9(t[y(5.c(0,2))]==null){b 2}9(u==15){e="19"+5.c(6,2)+"-"+h(5.c(8,2))+"-"+h(5.c(10,2));7 d=f m(e.n(/-/g,"/"));7 z=d.o().toString()+"-"+(d.A()+1)+"-"+d.B();9(e!=z){b 3}5=5.p(0,6)+"19"+5.p(6,15);5=5+GetVerifyBit(5)}7 C=f m();7 q=C.o();7 D=q-150;7 r=5.p(6,10);9(rq){b 3}5=5.n(/x$/i,"a");e=5.c(6,4)+"-"+h(5.c(10,2))+"-"+h(5.c(12,2));7 d=f m(e.n(/-/g,"/"));9(e!=(d.o()+"-"+(d.A()+1)+"-"+d.B())){b 3}E(7 i=17;i>=0;i--){l+=(Math.pow(2,i)%11)*y(5.charAt(17-i),11)}9(l%11!=1){b 1}7 j=f F();j=f F("11111119111111111","12121219121212121","123456789087654321");E(7 k=0;k鏌ョ湅 閲嶆柊涓婁紶"); $(area + " #UploadFrame").hide(); $(area + " .FileName").val("/" + newpath); $(area + " input[name=file]").val("/"+newpath); $(area + " div.viewbox").text("/" + newpath); }; function re_upload_file(area) { $(area + " #UploadFrame").attr("src", "/Plugin/FileManage/uploadImg.php?islarge=upload_1").show(); $(area + " .ViewSpan").html(""); $(area + " input[name=file]").val(""); $(area + " div.viewbox").text(""); }*/ $(function () { $('#btnSubmit').click(function () { /*濡傛灉閫氳繃琛ㄥ崟楠岃瘉*/ if (required()) { //var attrArgs = new Array();/*鍙傛暟鍚嶇О闆嗗悎*/ //var valArgs = new Array();/*鍙傛暟鍊奸泦鍚?/ /*$('.get:visible').map(function (i) { if (getValue($(this)).length != 0) { attrArgs[i] = $(this).attr('name'); valArgs[i] = escape(getValue($(this))); } });*/ var attrArgs = ""; var valArgs = ""; $('.get:visible').map(function(i) { if (getValue($(this)).length != 0) { attrArgs += $(this).attr('name') + ","; valArgs += escape(getValue($(this))) + "," } else { attrArgs += $(this).attr('name') + ","; valArgs += escape("") + "," } }); var data = "attrArgs=" + encryption(attrArgs) + "&valArgs=" + encryption(valArgs) + ""; ajaxhelpForm(data, function (msg) { var obj = eval('(' + msg + ')'); alert(unescape(obj.info)); if (unescape(obj.status) == 1) { window.location = this_url; } }); } }); }); function ajaxhelpForm(data, fn) { $.ajax({ "type": "post", "url": "../index.php?m=Forms&a=ValidateHandler", "data": data, "datatype": "html", "success": function (msg) { if (fn) { fn(msg); } }, "error": function () { /*alert("瀵逛笉璧?鏈嶅姟鍣ㄧ箒蹇欒绋嶅悗閲嶈瘯");*/ } }); } function onbtnSubmit(formid){ $('#myform').form('submit', { url:"../index.php?m=Forms&a=ValidateHandler", onSubmit: function(){ return required(); return $(this).form('validate'); }, success:function(data){ var data = eval('(' + data + ')'); alert(data.info); if (data.status==1) { window.location = this_url; } } }); } function changeCode(){ document.getElementById('forget_code_img').src='../api.php?m=Checkcode&code_len=4&font_size=14&width=124&height=37&font_color=&background=&time='+Math.random(); }