Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/12/2002, 16:29
Avatar de Kaopectate
Kaopectate
Colaborador
 
Fecha de Ingreso: diciembre-2001
Ubicación: Curaçao (Antillas Holandesas)
Mensajes: 3.179
Antigüedad: 22 años, 3 meses
Puntos: 38
2.- Radio buttons

P: ¿Como puedo conocer el valor del radiobutton seleccionado?

R: [ver ejemplo]

Código PHP:
<html>
 <
head>
  <
script language="JavaScript">
   var 
valor 0;

   function 
actualizaValor(oRad){
    
valor oRad.value;
   }

   function 
leeValor(){
    
with (document.frm)
     
res.value valor;
   }
  
</script>
 </head>
 <body>
  <form name="frm">
   <table border="0">
    <tr>
     <td>
      <input type="radio" name="rad" value="1" onclick="actualizaValor(this)">Valor uno
     </td>
     <td>
      <input type="radio" name="rad" value="2" onclick="actualizaValor(this)">Valor dos
     </td>
    </tr>
    <tr>
     <td>
      <input type="text" name="res">
     </td>
     <td>
      <input type="button" name="leer" value="Dime valor" onclick="leeValor()">
     </td>
    </tr>
   </table>
  </form>
 </body>
</html> 

Última edición por Kaopectate; 23/12/2002 a las 22:37