
Código HTML:
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>New document</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <script language="javascript" type="text/javascript"> function Mostrar (id,elem) { var t = "elemen" +id; var elemento = document.getElementById(t); elemento.value= elem; } </script> </head> <body> <form id="f1"> <input type="radio" name="sexo" id="sexo" value="Mujer" onclick="javacript:Mostrar(2,document.getElementById('sexo').value)" /> <input type="radio" name="sexo" id="sexo" value="Hombre" onclick="javacript:Mostrar(2,document.getElementById('sexo').value)"/> <br> <input type="text" id="elemen2" value="" /> </form> </body>
