Ver Mensaje Individual
  #7 (permalink)  
Antiguo 12/12/2011, 20:03
rpichinu
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 5 meses
Puntos: 3
Respuesta: validar mail jquery problema

ahy si..ahora lo probe y me funciono.....ahora como coloco el mensaje de mail incorrecto inmediatamente al colocarlo o por ejemplo al precionar tabuador...me salga el mensaje y no me deje avanzar a otro input mientras coloke una direccion de correo electronica valida....en otro ejemplo utilize algo asi ..pero ahora no me resulto

Código Javascript:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta name="" content="">
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  7. <script language="javascript" type="text/javascript">
  8. $(function(){
  9.     $("#formulario").submit(function () {  
  10.         if($("#email").val().indexOf('@', 0) == -1 || $("#email").val().indexOf('.', 0) == -1) {  
  11.             alert("La dirección e-mail parece incorrecta");  window.document.formulario.email.focus();     
  12.                 window.document.formulario.email.select();
  13.              
  14.         }  
  15.         return false;  
  16.     });  
  17.  });
  18. </script>
  19. </head>
  20. <body>
  21. <form id="formulario" name="formulario" method="post" action="">
  22.   nombre
  23.   <label>
  24.   <input type="text" name="nombre" id="nombre" />
  25.   </label>
  26.   <p>email
  27.     <label>email
  28.     <input type="text" name="email" id="email" />
  29.     </label>
  30.   </p>
  31.   <label>web
  32.   <input type="text" name="titulo" id="titulo" />
  33.     <br />
  34.     <br />
  35.     </label>
  36.    
  37.     <input type="submit" value="GUARDAR" />
  38.    
  39. </form>
  40. </body>
  41. </html>