Javascript常用方法积累
时间:2010-07-17 来源:songfantasy
$ = function(s) {return (typeof s == 'object') ? s: document.getElementById(s);}
/*
* 检查是否为IP
* @param value
*/
function validateIP(value) {
var ip = '(25[0-5]|2[0-4]\\d|1\\d\\d|\\d\\d|\\d)';
var ipdot = ip + '\\.';
var isIPaddress = new RegExp('^'+ipdot+ipdot+ipdot+ip+'$');
return isIPaddress.test(value);
}
/*
* 检查是否为IP
* @param value
*/
function validateIP(value) {
var ip = '(25[0-5]|2[0-4]\\d|1\\d\\d|\\d\\d|\\d)';
var ipdot = ip + '\\.';
var isIPaddress = new RegExp('^'+ipdot+ipdot+ipdot+ip+'$');
return isIPaddress.test(value);
}
相关阅读 更多 +