Quiz with multiple choice answers...

discworldian

Newbie

Posts: 5

3+ Months Ago

On my page (http://www.student.kun.nl/m.vanderheijden/whichwitch.html) I made a quiz with multiple choice answers, only I got feedback that the test was too easy to analyze since the choices that lead to the same answer are always in the same order. It seems that I need 10 times as much code to get a random order of answers. Does anyone know a faster way?

MiR

Bigwebmaster

Site Admin

Posts: 9189

Loc: Seattle, WA & Phoenix, AZ

3+ Months Ago

So like what do you mean? are the correct answers like the first option all the time for each question?

discworldian

Newbie

Posts: 5

3+ Months Ago

No, it's more like the quiz is about 3 characters from a book, and which character you most resemble. so first answer is for character 1, second answer for character 2, third answer for character 3.

What's the best way to cure the flu?<br>
<input type="radio" name="q2">Give the patient a medicine made out of rare herbs, which you have researched for years<br>
<input type="radio" name="q2">Give the patient a bottle of scumble and tell him/her to stay in bed if they like<br>
<input type="radio" name="q2">Give the patient a bottle of coloured water, which you say is a very special medicine<br>

What's the best way to cure the flu?<br>

<input type="radio" name="q2">Give the patient a medicine made out of rare herbs, which you have researched for years<br>

<input type="radio" name="q2">Give the patient a bottle of scumble and tell him/her to stay in bed if they like<br>

<input type="radio" name="q2">Give the patient a bottle of coloured water, which you say is a very special medicine<br>

and the way you have your javascript code it simply determines by the order in which they are checked to determine what value they get. What I would do is make each one worth a value and move them around like below:

What's the best way to cure the flu?<br>
<input type="radio" name="q2" value="2">Give the patient a bottle of scumble and tell him/her to stay in bed if they like<br>
<input type="radio" name="q2" value="3">Give the patient a bottle of coloured water, which you say is a very special medicine<br>
<input type="radio" name="q2" value="1">Give the patient a medicine made out of rare herbs, which you have researched for years<br>

What's the best way to cure the flu?<br>

<input type="radio" name="q2" value="2">Give the patient a bottle of scumble and tell him/her to stay in bed if they like<br>

<input type="radio" name="q2" value="3">Give the patient a bottle of coloured water, which you say is a very special medicine<br>

<input type="radio" name="q2" value="1">Give the patient a medicine made out of rare herbs, which you have researched for years<br>

Then you will have to rewrite your javascript code some to simply determine how many points to add by seeing what value the question is worth (instead of basing it on the order they are placed). I hope that makes sense.

discworldian

Newbie

Posts: 5

3+ Months Ago

Thanks, I'll try that.

MiR

killercelery

Newbie

Posts: 13

Loc: Montréal, Québec

3+ Months Ago

One great feature of html is the possibility to create new elements for a tag. For your problem, I simply created the element witch in each tag input. All you need to change in your current code is the two functions and add the witch element in each input tag like this: