表单验证


function Authentication(){}
        Authentication.prototype = {
            IsEmpty : function(obj,msg){
                if(trim(obj.value) == ""){
                    alert(msg);
                    obj.focus();
                    return false;
                }
                return true;
            },
            IsFormat : function(obj,param,msg){
                if(!param.test(obj.value)){
                    alert(msg);
                    obj.focus();
                    obj.select();
                    return false;
                }
                return true;
            }
        }

 

 


if(!a.IsFormat(txt_ConectPhone,/^(0)\d{2,3}(-)\d{7,8}$/,"联系电话不正确")) return false;

 


if(!a.IsFormat(txt_Handset,/^(0)?((13)|(15)|(18))?[0-9]{9}$/,"移动电话不正确")) return false;

posted @ 2009-03-26 18:17  .NET钉子户  阅读(167)  评论(0)    收藏  举报