Javascript : duplication champ radio
Résolu/Fermé
A voir également:
- Javascript : duplication champ radio
- Telecharger javascript - Télécharger - Langages
- Telecharger radio - Télécharger - Audio & Musique
- Javascript round ✓ - Forum Javascript
- Le nom du champ de tableau croisé dynamique n'est pas valide ✓ - Forum Excel
- Radio sur freebox pop - Forum Freebox
1 réponse
Alain_42
Messages postés
5358
Date d'inscription
dimanche 3 février 2008
Statut
Membre
Dernière intervention
13 février 2017
901
21 janv. 2009 à 17:40
21 janv. 2009 à 17:40
ça ne marche pas car tu as le même nom pour plusieurs id= donc le getElementById ne sait pas lequel atteindre
comme ça c'est bon chez moi:
@lain
comme ça c'est bon chez moi:
<script language="JavaScript">
function duplioui(){
if(document.getElementById('choix1a').checked==true) {document.getElementById('choix2a').checked=true}
if(document.getElementById('choix1b').checked==true) {document.getElementById('choix2b').checked=true}
}
function duplinon(){
document.getElementById('choix2a').checked=false;
document.getElementById('choix2b').checked=false;
}
</script>
<form id="form1" name="form1" method="post" action="">
choix 1 :
<input type="radio" name="choix1" id="choix1a" value="a" /> a
<input type="radio" name="choix1" id="choix1b" value="b" /> b
<br />
duplication
<input type="radio" name="duplication" id="duplication" value="oui" onclick="duplioui();"/> oui
<input type="radio" name="duplication" id="duplication" value="non" onclick="duplinon();"/> non
<br />
choix 2 :
<input type="radio" name="choix2" id="choix2a" value="a" /> a
<input type="radio" name="choix2" id="choix2b" value="b" /> b
<br />
</form>
@lain
21 janv. 2009 à 18:05
Merci beaucoup @lain