Validate an IP address with javascript:
Its just a regular expression, so it should work in PHP, or any language supporting
regular expressions, however most languages have ip validating functions, such as ip2long or long2ip in PHP :)
ipaddr = {
validate:function(ip){
var ip = new String(ip);
return (ip.match(/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/));
}
}
Usage:
< input type="text" name="ip" onblur="ipaddr.validate(this.value);" >
lunes, 27 de julio de 2009
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario