<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> Check if it is an IP address </TITLE>
<meta name= "Generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
</HEAD>
<BODY>
<TITLE>IP address legality Verification JS code-</title>
Please enter IP address: <input type= "text" id= "IP" >
<input type= "button" onclick= "Checkip ()" value= "Verify" >
</BODY>
</HTML>
<script language= "JavaScript" >
function Checkip ()
{
obj = document.getElementById ("IP"). Value;
IP Address
var exp=/^ (\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]) $/;
var reg = Obj.match (exp);
if (reg==null)
{
Alert ("IP address is not legal!") ");
}
Else
{
Alert ("IP address is legal!") ");
}
}
</script>
JS detects if the input box content is a legitimate IP address