Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/11/2016, 06:47
alvaro_trewhela
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: funcion con datos dinamicos

Ve como andas con esto:

Código HTML:
Ver original
  1. <script type="text/javascript">
  2. function verif(tipo){
  3. elements = document.getElementsByName(tipo);
  4.     for(var k=0; k<elements.length;k++){
  5.         if(elements[k].checked){
  6.         return true;
  7.         }
  8.     }
  9. return false;
  10. }
  11.  
  12.  
  13. <form method="post" action="" onsubmit="if(!verif('nublado') || !verif('lloviendo')){ alert('falta dato'); return false; }">
  14. nublado<br/>
  15. poco <input type="radio" name="nublado" value="poco"><br/>
  16. normal <input type="radio" name="nublado" value="normal"><br/>
  17. mucho <input type="radio" name="nublado" value="mucho"><br/>
  18.  
  19. <br/>
  20. <br/>
  21.  
  22. lloviendo<br/>
  23. poco <input type="radio" name="lloviendo" value="poco"><br/>
  24. normal <input type="radio" name="lloviendo" value="normal"><br/>
  25. mucho <input type="radio" name="lloviendo" value="mucho"><br/>
  26.  
  27. <input type="submit" value="go!!" />
  28.  
  29. </form>


Última edición por alvaro_trewhela; 17/11/2016 a las 08:09