函数代码如下:

function ValidateIPaddress(ipaddress)   {  
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(myForm.emailAddr.value)){
return (true)
}else{
return (false)
}
}

函数整理自:http://www.w3resource.com/javascript/form/ip-address-validation.php

Related Posts: JavaScript 校验验证IP是否合法 :