📅  最后修改于: 2022-03-11 15:02:20.656000             🧑  作者: Mango
ValidateIPaddress(prompt("Enter IP Address"));
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(ipaddress))
{
alert("The IP Address I Valid")
}
alert("You have entered an invalid IP address!")
}