Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/02/2013, 09:51
Avatar de DRANIX
DRANIX
 
Fecha de Ingreso: abril-2010
Mensajes: 24
Antigüedad: 14 años, 1 mes
Puntos: 1
Pregunta Valor De Pagina Hija A Pagina Padre

Hace Unos Dias Cheque Este Codigo De "caricatos" Un Saludo.
La Cuestion Es Que Me Di Cuenta Que Funciona Cuando Existen Dos Radios, Pero Si Solo Hay Uno Me Sigue Enviando El Mensaje De "debe seleccionar un radio".

Quisiera Saber Como Corregir Ese Detalle.. Espero Alguien Pueda Ayudarme..
Gracias
Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <title>Documento sin t&iacute;tulo</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5.  
  6. <script>
  7. function recuperaDato(f){
  8. valor = "";
  9. for (i = 0, d = f.dato, total = d.length; i < total; i ++)
  10.  if (d[i].checked) valor = d[i].value;
  11.  if (valor == "") alert("debe seleccionar un radio...")
  12.  else {
  13.   opener.document.getElementById("tela").value = valor;
  14.   window.close();
  15.  }
  16. }
  17. </script>
  18. </head>
  19.  
  20. <body>
  21. <form>
  22. <input type="radio" name="dato" value="uno" >
  23. Dato1<br>
  24. <input type="radio" name="dato" value="dos" >
  25. Dato1<br>
  26. <br>
  27. <br>
  28. <input type="button" value="Recupera Dato" onclick="recuperaDato(this.form);">
  29. </form>
  30. </body>
  31. </html>