Ver Mensaje Individual
  #6 (permalink)  
Antiguo 17/06/2010, 23:56
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 11 meses
Puntos: 310
Respuesta: funcion comprobar() no m funciona

Vamos a modificarla un poco...
Código Javascript:
Ver original
  1. function comprobar(n){
  2.  var seleccionado=false;
  3.  for(i=1;i<n;i++) {
  4.   if(document.getElementById('chk'+n).checked){
  5.    seleccionado=true;
  6.   }
  7.  }
  8.  if (!seleccionado){
  9.   alert ("Es imprescindible elegir la forma de pago");
  10.  }else{
  11.   if (document.getElementById('totalPedido').value!="NaN"){
  12.    document.formpedido.submit();    
  13.   }
  14.  }
  15. }

Código HTML:
Ver original
  1. <form name='formpedido' action='' method='post' onsubmit='return comprobar(5);'>
  2. <!----aquí va lo anterior--->
  3.  <input type='checkbox' id='chk1' />Valor 1
  4.  <input type='checkbox' id='chk2' />Valor 2
  5.  <input type='checkbox' id='chk3' />Valor 3
  6.  <input type='checkbox' id='chk4' />Valor 4
  7.  <input type='checkbox' id='chk5' />Valor 5
  8.  <input type='submit' value='Enviar' />
  9. </form>

Saludos (: