layui的IP验证

//验证
form.verify({
ip: function(value, item){
function isValidIP(ip) {
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])$/
return reg.test(ip);
}
if(isValidIP(value) == false){
return '请输入正确的IP地址';
}
}
});

posted @ 2018-11-28 10:50  rock_turf  阅读(1768)  评论(0编辑  收藏  举报