标签:c style class blog code java
var CommonCheck = { //两个时间比较 compareDate:function(end,start){ var d1Arr=end.split("-"); var d2Arr=start.split("-"); var ss1=new Date(d1Arr[0],d1Arr[1],d1Arr[2]); var ss2=new Date(d2Arr[0],d2Arr[1],d2Arr[2]); if(ss1<ss2){ return false; } return true; }, //是否为整数 isInteger:function(s){ var reg = /^[+-]?\d{1,9}$/; if(reg.exec(s)) return true; else return false; }, //是否为正整数 isPositiveInteger:function(s){ var reg = /^[0-9]*[0-9][0-9]*$/; if(reg.exec(s)) return true; else return false; }, //是否为正确的IP isIP:function(s) { var reg=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; if(reg.exec(s)) return true; else return false; }, //是否为正确的电话号码 isTelephone:function(s) { var reg=/^1[3|5][0-9]\d{4,8}$/; if(reg.exec(s)) return true; else return false; }, isMail:function(s) { var reg=/[a-z0-9-]{1,30}@[a-z0-9-]{1,65}.[a-z]{3}/; if(reg.exec(s)) return true; else return false; }, isMailNum:function(s) { var reg=/^[1-9]\d{5}$/; if(reg.exec(s)) return true; else return false; }, isUR:function(s) { var reg="^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*‘().&=+$%-]+: )?[0-9a-z_!~*‘().&=+$%-]+@)?" //ftp的user@ + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 + "|" // 允许IP和DOMAIN(域名) + "([0-9a-z_!~*‘()-]+\.)*" // 域名- www. + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 + "[a-z]{2,6})" // first level domain- .com or .museum + "(:[0-9]{1,4})?" // 端口- :80 + "((/?)|" // a slash isn‘t required if there is no file name + "(/[0-9a-z_!~*‘().;?:@&=+$,%#-]+)+/?)$"; var re=new RegExp(reg); if(re.exec(s)) return true; else return false; }, isURL:function(s) { var reg=/http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/; if(reg.exec(s)) return true; else return false; } }
标签:c style class blog code java
原文地址:http://www.cnblogs.com/geksong/p/3774585.html