Tema: Validaciones
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/05/2015, 20:42
Avatar de yoyo_38tuzo
yoyo_38tuzo
 
Fecha de Ingreso: febrero-2015
Mensajes: 44
Antigüedad: 9 años, 2 meses
Puntos: 0
Validaciones

Tengo un enorme problema ya que me ejecuta las validaciones pero aun me manda el formulario y quiero que no me lo mande, les dejo elcodigo, espero pueden ayudarme amigos...

Código Javascript:
Ver original
  1. function txtvacio()
  2. {
  3. valor = document.forms["form1"]["alimentacion"].value;
  4. if(valor == "" || valor == null || valor.length == 0) {
  5.   return false;
  6. }  
  7. }
  8. function suma(){
  9. suma=document.form1;
  10. suma.totalema.value=parseInt(suma.alimentacion.value)+parseInt(suma.combustible.value)+parseInt(suma.renta.value)+parseInt(suma.agua.value)+parseInt(suma.electricidad.value)+parseInt(suma.educacion.value)+parseInt(suma.telefono.value)+parseInt(suma.transporte.value)+parseInt(suma.gastosmedicos.value)+parseInt(suma.recreacion.value);
  11. var res =  get_total();
  12. $(".ema_final").val(res);
  13. }
  14. function get_total()
  15. {
  16.   var r = 0;
  17.   var total = $(".total_ema").val();
  18.   if (total <= 1500)
  19.   {
  20.     return r = 1 ;
  21.   }
  22.   if(total >= 1501 && total <= 2500)
  23.   {
  24.     return r = 2;
  25.   }
  26.   if(total >= 2501 && total <= 3500)
  27.   {
  28.     return r = 3;
  29.   }
  30.   if (total >= 3501 && total <= 4500)
  31.   {
  32.     return r = 4;
  33.   }
  34.   if(total > 4500)
  35.   {
  36.     return r = 5;
  37.   }
  38. }
  39. function ValidaSoloNumeros() {
  40.  if ((event.keyCode < 48) || (event.keyCode > 57))
  41.   event.returnValue = false;
  42. }