/** * this script is include in * 这个文件包含于 * booen.com/passport/login.php */ /* 保留的中文注释 用于检测文本编码 */ /** * 初始化焦点 */ (function ($) { $(function () { var account = $("input[name='useraccount']:first"); var account_noti = $("#_useraccount_noti"); var password = $("input[name='userpassword']:first"); var password_noti = $("#_userpassword_noti"); var valicode = $("input[name='uservalicode']:first"); var valicode_noti = $("#_uservalicode_noti"); var login_form = $("#login_form"); var valicode_img = $("#valicode"); var error_list = {}; account.focus(); if (vali_state == "try") { $("._vali_code").hide(); } else { valicode_img.getvalicode(); valicode_img.show(); valicode_img.click(function () { valicode_img.getvalicode(); }); } /* account */ account.blur(function () { var val = $.trim(account.val()); account.val(val); var regexp = new regexp("^[a-za-z0-9\一-\龥][a-za-z0-9\一-\龥\-_]{1,34}[a-za-z0-9\一-\龥]$", ""); if(val.indexof("@") >= 0){ var pass = true; var accounts = val.split("@", 2); var _regexp = new regexp("^[a-za-z0-9\一-\龥][a-za-z0-9\一-\龥\-_]{0,34}[a-za-z0-9\一-\龥]$", ""); if (!_regexp.test(accounts[0])) { pass = false; } if (!regexp.test(accounts[1])) { pass = false; } }else{ pass = regexp.test(val); } error_list["account"] = pass; if (pass) { account_noti.attr({ "title": "" }) .removeclass("wrong tips") .addclass("ok") .show(); account_noti.html(''); } else { account_noti.attr({ "title": lang.fromfilter_useraccount_notmatch }) .removeclass("ok") .addclass("wrong tips") .show(); account_noti.html(lang.fromfilter_useraccount_notmatch); } }); /* end account */ /* password */ password.blur(function () { var val = password.val(); var len = val.length; var pass = len >= 6 && len <= 36; error_list["password"] = pass; if (pass) { password_noti.attr({ "title": "" }) .removeclass("wrong tips") .addclass("ok") .show(); password_noti.html(''); } else { password_noti.attr({ "title": lang.fromfilter_userpassword_notmatch }) .removeclass("ok") .addclass("wrong tips") .show(); password_noti.html(lang.fromfilter_userpassword_notmatch); } }); /* end password */ if (vali_state != "try") { /* valicode */ valicode.blur(function () { var val = valicode.val(); var regexp = new regexp("^[0-9]{5}$", ""); var pass = regexp.test(val); error_list["valicode"] = pass; if (pass) { valicode_noti.attr({ "title": "" }) .removeclass("wrong tips") .addclass("ok") .show(); valicode_noti.html(''); } else { valicode_noti.attr({ "title": lang.fromfilter_uservalicode_notmatch }) .removeclass("ok") .addclass("wrong tips") .show(); valicode_noti.html(lang.fromfilter_uservalicode_notmatch); } }); /* end valicode */ } login_form.submit(function () { var pass = 1; account.blur(); password.blur(); valicode.blur(); for (var key in error_list) { pass &= error_list[key]; } return !!pass; }); }) })(jquery);