Tema: Validar mail
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/11/2007, 06:08
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 8 meses
Puntos: 3
Validar mail

No me funciona.

Código PHP:
<script language="JavaScript">
function 
CompruebaMail(Campo)
{
   if (
Campo.value == '') return false;
   
Campo.value Campo.value.toLowerCase();
   
Campo.value Campo.value.replace(/ /g"");
   if (/..|.@|@.|^.|.$/.
test(Campo.value))
      return 
false;
   if (/.([
a-z]{2,3}|info|name|museum)$/.test(Campo.value))
      if (/^[
_.0-9a-z-]+@([0-9a-z-]+.)+[a-z]*$/.test(Campo.value))
         return 
true;
   return 
false;
}



function 
CompruebaForm()
{  
   if (
document.frm.email.value == '')
   {
      
alert('Debe rellenar el campo e-Mail');
      
document.frm.email.focus();
      return 
false;
   }
   if (!
CompruebaMail(document.frm.email))
   {
      
alert('La dirección de e-mail no es válida');
      
document.frm.email.focus();
      return 
false;
   }
   return 
true;
}
</script>

    <td><input type="text" name="email" onBlur="return CompruebaForm();"> 
Ayuda por favor