Hola a todos.
Sigo pegándome con el Javascript, y la verdad es que ya me van saliendo algunas cosas, pero en otras me quedo muy atascado.
Os cuento, necesito que en un formulario en el que tengo una pregunta activada y otra desactivada, al seleccionar una de las 4 opciones disponibles de la primer pregunta, se me active la segunda pregunta. Lo he probado todo pero no lo consigo.
El código que he usado es el siguiente...
Código HTML:
<html>
<head>
<script language="javascript">
function habilita(){
document.frm.opt2.disabled = false;
}
function deshabilita(){
document.frm.opt2.disabled = true;
document.frm.opt2.value = "";
}
</script>
</head>
<body>
<p><strong>Cuestionario </strong></p>
<form name="frm">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20"><strong>1.- ¿ pregunta 1 ?</strong></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35" height="20"> </td>
<td bgcolor="#F2F2F2"> a.- opcion 1 (responda pregunta 3) </td>
<td width="40" bgcolor="#F2F2F2"><input name="opt1" type="radio" value="1a" onClick="habilita()"></td>
</tr>
<tr>
<td width="35" height="20"> </td>
<td bgcolor="#F2F2F2"> b.- opcion 2 </td>
<td width="40" bgcolor="#F2F2F2"><input name="opt1" type="radio" value="1b" onClick="deshabilita()"></td>
</tr>
<tr>
<td width="35" height="20"> </td>
<td bgcolor="#F2F2F2"> c.- opcion 3 </td>
<td width="40" bgcolor="#F2F2F2"><input name="opt1" type="radio" value="1c" onClick="deshabilita()"></td>
</tr>
<tr>
<td width="35" height="20"> </td>
<td bgcolor="#F2F2F2"> d.- opcion 4 </td>
<td width="40" bgcolor="#F2F2F2"><input name="opt1" type="radio" value="1c" onClick="deshabilita()"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="30"> </td>
</tr>
<tr>
<td height="20"><strong>2.- (Activar sólo si respuesta 2 es a) ¿ pregunta 2 ?</strong></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35" height="20"> </td>
<td bgcolor="#F2F2F2"> a.- Sí </td>
<td width="40" bgcolor="#F2F2F2"><input name="opt2" type="radio" value="2a" disabled></td>
</tr>
<tr>
<td width="35" height="20"> </td>
<td bgcolor="#F2F2F2"> b.- No, ya disponía de tarjeta Wi-fi integrada en el ordenador</td>
<td width="40" bgcolor="#F2F2F2"><input name="opt2" type="radio" value="2b" disabled></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
Alguien me puede echar una mano??
Muchas gracias
Saludos Romanos
Moloko