addition avec concaténation
Bonjour à tous,
Alors voilà j'ai un soucis avec une addition qui se concatène...
voici mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
<form name="ee">
Choix 1 <input type="radio" name="dmc" value="9">
Choix 2 <input type="radio" name="dmc" value="8">
Choix 3 <input type="radio" name="dmc" value="5">
Choix 4 <input type="radio" name="dmc" value="4">
Choix 5 <input type="radio" name="dmc" value="5">
Choix 6 <input type="radio" name="dmc" value="6">
<input type="button" name="bout" value="Tester" onClick="teste()"><BR>
Vous avez <input type="text" name="points" readOnly> Bonne réponses.
</form>
<script type="text/javascript">
function teste() {
for (i=0;i<6;i++) {
if (document.forms.ee.dmc[i].checked==true) {
document.forms.ee.points.value=parseInt(document.forms.ee.points.value)+parseInt(document.forms.ee.dmc[i].value)
}
}
}
</script> |
Si quelqu'un peut m'aider merci.