Mettre un textbox en readonly
Bonjour
Je souhaiterai que lorsque je coche un radio une fonction java soit executée pour mettre des textbox en readonly.
J'ai essayé mais ça ne fonctionne pas.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10
| <input type="radio" name="Age_Choix" value="Age_Choix_Entre" onClick="Choix()">
entre
<input name="Age_Début" type="text" size="3" maxlength="3">
et
<input name="Age_Fin" type="text" size="3" maxlength="3">
<br>
<br>
<input type="radio" name="Age_Choix" value="Age_Choix_Sup" onClick="Choix()">
Supérieur à :
<input name="Age_Superieur" type="text" size="3" maxlength="3"> |
Fonction javascript :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <script language="javascript">
function Choix()
{
for (var i=0; i<FormChoixParam.Age_Choix.length;i++)
{
if ((FormChoixParam.Age_Choix[i].checked) && (i==0))
{
FormChoixParam.Age_Superieur.readonly = true;
}
else
{
if ((FormChoixParam.Age_Choix[i].checked) && (i==1))
{
FormChoixParam.Age_Début.readonly = true;
FormChoixParam.Age_Fin.readonly = true;
}
}
}
} |
Merci