I am trying to create a simple questionnaire for a website but am fairly new to javascript and html
I do have a basic function to calculate a percentage and have created the html form with radio buttons and a submit button
There will be about 20 questions in the questionnaire which will have yes/no radio buttons.
What I need to do is have a way of looking at each question to see if the user answered yes or no.
If they answered yes then I need to keep total to then work out how many questions they answered yes too.
After the user has pressed the submit button I then need to display a summary based on the yes answer percentage calculated above
The summary may look like the following:
– To 33% and below you have ticked yes this mean THIS
– To 66% and below you have ticked yes this mean SOMETHING ELSE
function CalculatePercentage() {
a = document.form1.c.value;
b = 10;
c = a/b;
d = c*100;
document.form1.total2.value = d
}
Could someone please point me in the right direction on how to find out if a radio button question answer is yes or not and then how to create the summary based on the percentage?
Thank you
First you need to calculate all the radio button values
JavaScript:
//calculate percentage
to be continued