Hi guys i need some advice on how to get my javascript running correctly
I have a large HTML radio button form with multiple radio button groups (40 groups 4 radio buttons per group), i have a javascript funtion which will check the radio buttons once the submit button is pressed however the code never gets past the first radio button, i dont know how to change the code so that it will display all the results from the quiz.
Any help would be greatly appreciated
The code i got for the radio buttons is as follows
<label>
<input type="radio" name="question40" value="answer1">
links</label>
<br/>
<label>
<input type="radio" name="question40" value="answer2">
e-mail</label>
<br/>
<label>
<input type="radio" name="question40" value="answer3">
favourites</label>
<br/>
<label>
<input type="radio" name="question40" value="answer4">
forward-back</label>
the code for the javascript is as follows
<script type = "text/JavaScript">
function checkAnswers() {
if(form1.question1[0].checked){
document.write("Question 1 = Correct")
}
else{
document.write("Question 1 = Incorrect")
}
if(form1.question2[3].checked){
document.write("Question2 = Correct")
}
else{
document.write("Question 2 = Incorrect")
}
}
</script>
obviously not complete yet as i cant get past the first radio button
I have a large HTML radio button form with multiple radio button groups (40 groups 4 radio buttons per group), i have a javascript funtion which will check the radio buttons once the submit button is pressed however the code never gets past the first radio button, i dont know how to change the code so that it will display all the results from the quiz.
Any help would be greatly appreciated
The code i got for the radio buttons is as follows
<label>
<input type="radio" name="question40" value="answer1">
links</label>
<br/>
<label>
<input type="radio" name="question40" value="answer2">
e-mail</label>
<br/>
<label>
<input type="radio" name="question40" value="answer3">
favourites</label>
<br/>
<label>
<input type="radio" name="question40" value="answer4">
forward-back</label>
the code for the javascript is as follows
<script type = "text/JavaScript">
function checkAnswers() {
if(form1.question1[0].checked){
document.write("Question 1 = Correct")
}
else{
document.write("Question 1 = Incorrect")
}
if(form1.question2[3].checked){
document.write("Question2 = Correct")
}
else{
document.write("Question 2 = Incorrect")
}
}
</script>
obviously not complete yet as i cant get past the first radio button