Código HTML:
<script> function habilitar(value) { if(value=="Si" || value==true) { // habilitamos document.getElementById("cod_program_est").disabled=false; document.getElementById("cod_ins").disabled=false; document.getElementById("cod_anio_aprob").disabled=true; }else if(value=="No" || value==false){ // deshabilitamos document.getElementById("cod_program_est").disabled=true; document.getElementById("cod_ins").disabled=true; document.getElementById("cod_anio_aprob").disabled=false; } } </script>
Código PHP:
<td>* ¿Estudia actualmente?:
<select name="estudia_act_cab" id="estudia_act_cab" onchange="habilitar(this.value);">
<option value="0">Seleccione...</option>
<option value="Si">Si</option>
<option value="No">No</option>
</select></td>
<td>Entidad educativa:
<select disabled name='cod_program_est' id="cod_program_est">
<option value="0"selected></option>
<?
$sql3 = "select * from program_est";
$result3 = mysql_query ($sql3, $link);
while ($row = mysql_fetch_array ($result3)) {
$mcodpr = $row['cod_program_est'];
$mprog = $row['dtalle_program_est'];
if ($pro == $mcodas)
echo "<option value= '$mcodpr'> $mprog </option>";
else
echo "<option value= '$mcodpr'> $mprog</option>";
}
echo "</option>";
?>
</select></td>
</tr>
<tr>
<td>* Tipo de institucion actual:
<select disabled name='cod_ins' id="cod_ins">
<option value="0"selected></option>
<?
$sql3 = "select * from institucion";
$result3 = mysql_query ($sql3, $link);
while ($row = mysql_fetch_array ($result3)) {
$mcodpr = $row['cod_ins'];
$mprog = $row['dtalle_ins'];
if ($pro == $mcodas)
echo "<option value= '$mcodpr'> $mprog </option>";
else
echo "<option value= '$mcodpr'> $mprog</option>";
}
echo "</option>";
?>
</select></td>
<td>* Último año aprobado:
<select disabled name='cod_anio_aprob' id="cod_anio_aprob">
<option value="0"selected></option>
<?
$sql3 = "select * from anio_aprob";
$result3 = mysql_query ($sql3, $link);
while ($row = mysql_fetch_array ($result3)) {
$mcodpr = $row['cod_anio_aprob'];
$mprog = $row['dtalle_anio_aprob'];
if ($pro == $mcodas)
echo "<option value= '$mcodpr'> $mprog </option>";
else
echo "<option value= '$mcodpr'> $mprog</option>";
}
echo "</option>";
?>
</select></td>