Bonjour,

J'essaie d'adapter ce code javascript trouvé sur le net pour plusieurs bouton radio mais je sèche... car mes connaissances en javascript sont limitée.

Je met le code d'exemple ci-dessous pour un seul groupe de boutons radio:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
<script language="javascript1.2">
function change() {
choix = ""
len = document.counter.radio1.length
for (i = 0; i <len; i++) {
if (document.counter.radio1[i].checked) {
choix = document.counter.radio1[i].value
}
}
if (choix == "") {
document.counter.rv1.value="vide";
document.counter.submit();
}
else {
document.counter.rv1.value=choix;
document.counter.submit();
}
}
</script>
 
</head>
<body>
 
<form name="counter" method="post" action="test2.php">
1 ---  
A<input type="radio" name="radio1" value="1">
B<input type="radio" name="radio1" value="0">
C<input type="radio" name="radio1" value="0">
D<input type="radio" name="radio1" value="0">
E<input type="radio" name="radio1" value="0" >
<input name="rv1" type="text" size="5">
<br>
 
2 ---  
A<input type="radio" name="radio2" value="0">
B<input type="radio" name="radio2" value="0">
C<input type="radio" name="radio2" value="1">
D<input type="radio" name="radio2" value="0">
E<input type="radio" name="radio2" value="0" >
<input name="rv2" type="text" size="5">
 
<br>
<input type="button" name="Submit2" value="envoi" onClick="change()"> 
</form>
 
 
</body>
</html>
Merci d'avances pour vos suggestion et informations.

Cordialement

Roland