![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
19/05/2009, 12:30
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 38
Antigüedad: 17 años, 4 meses Puntos: 0 | |
Respuesta: validar correos Hola, este es mi codigo, xq no se otro, no se como sería con las expresiones regulares, ya que como te digo, mi campo puede tener de 1 a 5 correos:
Gracias
// JScript File
var text=valor.value;
function validarEmail(valor)
{
var text=valor.value;
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+\;\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+\;\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(text))
{
alert("ehhhhh");
return (true)
}
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+\;\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+\;\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+\;\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(text))
{
alert("ehhhhh");
return (true)
}
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(text))
{
alert("ehhhhh");
return (true)
}
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+\;\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(text))
{
alert("ehhhhh");
return (true)
}
else
{
valor.focus();
alert("La dirección de email es incorrecta y entre correos debe estar separado por ";" punto y coma y sin espacios");
return (false);
}
} |