- $("#postcode").blur(function(){
-
- var postcode=$("#postcode").val();
- if(is_postcode(postcode)){
- $("#postcode_info").html("");
- }else{
- $("#postcode_info").html("邮编格式不正确");
- return false;
- }
- });
-
-
- $("#mobile").blur(function(){
-
- var mobile=$.trim($("#mobile").val());
- if(is_mobile(mobile)){
- $("#mobile_info").html("");
- }else{
- $("#mobile_info").html("手机号格式不正确");
- return false;
- }
- });
-
-
- $("#email").blur(function(){
-
- var email=$("#email").val();
- if(is_email(email)){
- $("#email_info").html("");
- }else{
- $("#email_info").html("电子邮件格式不正确");
- return false;
- }
- });
- });
-
- function is_postcode(postcode) {
- if ( postcode == "") {
- return false;
- } else {
- if (! /^[0-9][0-9]{5}$/.test(postcode)) {
- return false;
- }
- }
- return true;
- }
-
- function is_mobile(mobile) {
- if( mobile == "") {
- return false;
- } else {
- if( ! /^0{0,1}(13[0-9]|15[0-9]|18[0-9]|14[0-9])[0-9]{8}$/.test(mobile) ) {
- return false;
- }
- return true;
- }
- }
-
- function is_email(email) {
- if ( email == "") {
- return false;
- } else {
- if (! /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/.test(email)) {
- return false;
- }
- }
- return true;
- }