var formValidate = { checkEmail: function(str) { var status = 1, msg = ''; var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; if (!str) { status = 0;msg = '邮箱不能为空'; } else { status = reg.test(str) if (!status) { status = 0; msg = '邮箱格式不符合要求'; } } return { status: status, msg: msg } }, checkPhone: function(str) { var status = 1, msg = ''; var reg = /\d{3}-\d{8}|\d{4}-\d{7}/; if (!str) { status = 0;msg = '不能为空'; } else { status = reg.test(str) if (!status) { status = 0; msg = '座机号格式不正确'; } } return { status: status, msg: msg } }, checkMobile: function(str) { var status = 1, msg = ''; var reg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/; if (!str) { status = 0;msg = '不能为空'; } else { status = reg.test(str) if (!status) { status = 0; msg = '手机号格式不正确'; } } return { status: status, msg: msg } } }