/*
Purpose: Verify the format of IP address
Input: Strip:ip Address
Returns: False if return true through validation;
*/
Java code
1. function f_check_ip (obj)
2. {
3. Var re=/^ (d+). (d+). (d+). (d+) $/; Regular expressions that match an IP address
4. if (Re.test (Obj.value))
5. {
6. If (regexp.$1 <256 && regexp.$2<256 && regexp.$3<256 && regexp.$4<256) Retu RN true;
7.}
8. F_alert (obj, "Please enter a legitimate computer IP address");
9. return false;
10.}
11.
function F_check_ip (obj)
{
var re=/^ (d+). (d+). (d+). (d+) $/; Regular expressions that match an IP address
if (Re.test (Obj.value))
{
if (regexp.$1 <256 && regexp.$2<256 && regexp.$3<256 && regexp.$4<256) return true;
}
F_alert (obj, "Please enter a legitimate computer IP address");
return false;
}
/*
Purpose: Check if the value of the input object conforms to the port number format
Input: str input string
Return: False if return true through validation
*/
Java code
1. Function F_check_port (obj)
2. {
3. if (!f_check_number (obj))
4. & nbsp; return false;
5. if (obj.value < 65536)
6. return true;
& nbsp 7. F_alert (obj, "Enter the valid computer IP address port number");
8. Return false;
9.}
10.
Function F_check_port (obj)
{
if (!f_check_number (obj)
return false;
if (Obj.value < 65536)
return true;
F_alert (obj, "Please enter a legitimate computer IP address port number");
return false;
}