Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/09/2012, 11:31
Avatar de fermin3d
fermin3d
 
Fecha de Ingreso: octubre-2010
Ubicación: sevilla
Mensajes: 141
Antigüedad: 14 años, 6 meses
Puntos: 4
Respuesta: return false;

ok disculpa

Código Javascript:
Ver original
  1. function validacion(){
  2.  
  3.  
  4.                      valor = document.getElementById("nombre").value;
  5.                      valor2 = document.getElementById("email").value;
  6.                      valor3 = document.getElementById("email").value;
  7.                      valor4 = document.getElementById("localidad").value;
  8.                      valor5 = document.getElementById("depar").selectedIndex;
  9.                      valor6 = document.getElementById("asunto").value;
  10.                      valor7 = document.getElementById("texto").value;
  11.                    
  12.                     if ( valor == null || valor.length == 0 || /^\s+$/.test(valor) ){
  13.                          
  14.                          alert('Por favor, Escriba su Nombre');
  15.                          nombre.focus();
  16.                          return false;
  17.                                           }else
  18.                     if ( valor2 == null || valor2.length == 0 || /^\s+$/.test(valor2)){
  19.                        
  20.                          alert('Por favor, Escriba su Email');
  21.                          email.focus();
  22.                          return false;
  23.                        
  24.                                           }else
  25.                     if ( !(/^[a-z0-9]+[a-z0-9\_\-\.]*[a-z0-9]+@{1}[a-z0-9]{2,128}\.([a-z0-9]{2,6}(\.[a-z0-9]{2,4})?)$/i.test(valor3))){
  26.                        
  27.                          alert('Por favor, Escriba un Email correcto');
  28.                          email.focus();
  29.                          return false;
  30.                        
  31.                                          }else
  32.                     if ( valor4 == null || valor4.length == 0 || /^\s+$/.test(valor4) ){
  33.                        
  34.                         alert('Por favor, Escriba su Localidad');
  35.                         localidad.focus();
  36.                         return false;
  37.                        
  38.                                         }else
  39.                     if ( valor5 == null || valor5 ==0){
  40.                        
  41.                        
  42.                         alert('Por favor, Seleccione un Departamento');
  43.                         depar.focus();
  44.                         return false;
  45.                        
  46.                                         }else
  47.                     if ( valor6 == null || valor6.length == 0 || /^\s+$/.test(valor6) ){
  48.                        
  49.                         alert('Por favor, Escriba su Asunto');
  50.                         asunto.focus();
  51.                         return false;
  52.                        
  53.                                         }else
  54.                     if ( valor7 == null || valor7.length == 0 || /^\s+$/.test(valor7) ){
  55.                        
  56.                         alert('Por favor, Escriba su Mensaje');
  57.                         return false;
  58.                        
  59.                                         }
  60.                    
  61.                         return true;
  62.                                         }

Código HTML:
Ver original
  1. <form method="post" action="enviar.php" onsubmit="return validacion()" name="form" >
  2. <td><input type="submit" name="enviar" value="Enviar" style="padding:5px;" /></td>
  3.             </tr>
  4.    </table>
  5.    </form>