Bonjour, je dois creer un mini test sur java script, j ai deja les questions mais je n arrive pas a synchroniser le bouton "submit" avec les question dans le but que lorsque je clique dessus je puisse avoir ma reussite en pourcentage, selon si j ai bien repondu aux questions ou non.
Est ce que quelqu un saurait m aider et corriger mes fautes vu mon faible niveau en html ?
merci beaucoup !
Code html : 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104 <html> <head> <title>Test page</title> <script language="JavaScript"> function score(){ var score=0; if (document.myform.r1[1].checked == true) score++; if (document.myform.r2[0].checked == true) score++; if (document.myform.r3[0].checked == true) score++; if (document.myform.r4[3].checked == true) score++; if (document.myform.r5[2].checked == true) score++; if (document.myform.r6[2].checked == true) score++; window.alert("Your score is: " + score); } </script> </head> <body> <h1><center>IQ test</center></h1> <form name = "myform"> <td valign="top">1.</td> What is the name of the first US's president:<br> Franklin D.Roosevelt<input type ="radio" name =" r1" value =1 checked><br> George Washington<input type = "radio" name = "r1" value = 2><br> Thomas Jefferson <input type = "radio" name = "r1" value = 3><br><br> <td valign="top">2.</td> Which number should come next in the series ?<br> 5-10-15-20 <br> <br> 25<input type = "radio" name = "r2" value = 1 checked><br> 26<input type = "radio" name = "r2" value = 2><br> 30<input type = "radio" name = "r2" value = 3><br> <br> <td valign="top">3.</td> "In this world nothing can be said to be certain, except death and taxes." This statement was made by Benjamin Franklin. <br/> <br/> <input type = "radio" name = "r3" value =1 checked>True <input type = "radio" name = "r3" value =2>False <br> <td valign="top">4.</td> Which one of the five choices makes the best comparison?<br>WATCH is to HCTAW as 46251 is to:</td></tr><br> <br> <input type = "radio" name = "r4" value =1>25641<br> <input type = "radio" name = "r4" value=2>12654<br> <input type = "radio" name = "r4" value=3>51462<br> <input type = "radio" name = "r4" value=4 checked>15264 <br> <br> <td valign="top">5.</td> Forest is to tree as tree is to?<br> <br> <button class ='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' type="radio" name = "r5" value =1>Plant</button> <br> <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' type="radio" name = "r5" value =2>Branch</button> <br> <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' type="radio" name = "r5" value=3 >Leaf</button> <br> <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' type="radio" name = "r5" value =4>Mangrove</button> <br> <br> <td valign="top">6.</td> The day after the day after tomorrow is four days before Monday. What day is it today ?<br> <SELECT NAME="answer1" SIZE=1> <OPTION SELECTED VALUE="0">-- Choose the correct answer -- <OPTION VALUE="1">Tuesday <OPTION VALUE="2">Monday <OPTION VALUE="1">Wednesday <OPTION VALUE="1">Thursday </SELECT> <br> <br> <input type = "button" value = "Submit" onclick = "score()"> <br> </form> </body></html>
Partager