Bonjour,
J ai un formulaire qui contient 2 boutons radios avec chacun son champ de texte qui est par defaut desactivé.
Je veux qu'une fois le bouton est coché, le champ de texte sera activé.
Mais avec mon code qui marche dans un cas mais pas dans un autre, ça marche pas encore :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
<tr>
      <th width="274" rowspan="2">Remise</th>
      <th width="77"><input type="radio" name="2" id="1" onClick="changement();"></th>
      <th width="321"><input type="text" name="p" style="width:200" disabled="disabled" id="p"></th>
</tr>
<tr>
      <th height="33"><input type="radio" name="2" id="2" onClick="changement();"></th>
      <th>&nbsp;<input type="text" name="p" style="width:200" disabled="disabled" id="v"></th>
</tr>
Code javascript
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
function changement() 
{ 
      if (document.getElementById('1').checked == true) 
	document.getElementById('p').disabled=false; 
      else 
	document.getElementById('p').disabled=true;
 
     if (document.getElementById('2').checked == true) 
	document.getElementById('v').disabled=false; 
     else 
	document.getElementById('v').disabled=true;
}
Merci d'avance