Premetto che ho appena iniziato a usare il javascript quindi non sono molto bravo.
Ho un form dove c'è un campo checkbox e un campo select, io vorrei che se un utente seleziona il campo checkbox il select venga disabilitato.
ecco il codice javascript:
<script type="text/javascript">
<!--
function Partecipo()
{
if(document.getElementById())
{
var A = document.getElementById('Partecipo').checked;
if(A == true)
{
document.getElementById('Programmi').setAttribute( 'disabled','disabled');
alert(A);
}
else
{
if(A == false)
{
document.getElementById('Programmi').removeAttribu te('disabled');
alert(A);
}
}
}
}
-->
</script>
ecco il codice del form:
<td height="30" colspan="2">
<center><input name="Partecipo" type="checkbox" id="Partecipo" onclick="Partecipo()"/>Desidero partecipare</center>
</td>
</tr>
<tr>
<td height="30" colspan="2">
<center>
<select name="Programmi" id="Programmi">
<option value='1'>voce1</option>
<option value='2'>voce2</option>
<option value='3'>voce3</option>
<option value='4'>voce4</option>
<option value='5'>voce5</option>
<option value='6'>voce6</option>
</select>
</center>
</td>
</tr>
il problema è che non funziona.