Bonjour, je dois creer un mini test de QI, j ai reussi a creer les questions avec le code suivant mais je na rrive pas a synchroniser avec le bouton "submit".
il faut que lorsque j appuie sur le bouton submit il y ait un message me donnant mon pourcentage de reussite, savez vous ce aue je dois modifier dans mon code pour qu il fonctionne s il vous plait ???? merci !
Code HTML:<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++; 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' = radio name = r5 value =1>Plant</button> <br> <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value =2>Branch</button> <br> <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value=3 checked>Leaf</button> <br> <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = 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> <input type = "button" value = "Submit" onclick = "score()"> <br> </form> </body></html>
-----