bjr
J'ai3 boutons radio

je veux quand je clique sur le 1er il m'affiche le mot 'admin'
" " " 2eme " le mot 'prof'
et quand je clique sur le 3eme il affiche le mot 'etud'
voila le code mais ça na pas marché ou est l'erreur svp

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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <script language="JavaScript">
<!--
function verif()
{
for (counter = 0; counter < form1.r1.length; counter++)
{
if (form1.r1[counter].checked)
//break;
var choice=document.form1.r1.value;
}
if (choice=='admin')
{
alert('admin');
}
else if (choice=='prof')
{
alert('prof');
}
else  if (choice=='etud')
{
alert('etud');
}
return;
}
-->
  </script>
<style type="text/css">
<!--
body {
	background-color: #004080;
}
-->
</style></head>
 
<body> <br>
<form action="" method="post" name="form1" id="form1">
  <p>
    <input type="radio" name="r1" value="admin" onSelect="verif()">
admin  </p>
  <p>
    <input type="radio" name="r1" value="prof" onSelect="verif()">
prof  </p>
  <p>
    <input type="radio" name="r1" value="etud" onSelect="verif()"> 
    etud
  </p>
</form>