View Full Version : Quiz scripting...


mocha
03-06-2003, 08:44 PM
Hi,

I am currently working on a quiz script which takes the answers selected and matches them up with one of the possibe results. (What Buffy character are you, etc.)

I understand the basics, but I don't know how to make one value in the script apply to more than one result.

ie
for (i = 0; i < f.one.length; i++) if
(f.one[i].checked) value = f.one[i].value;
if (value == "1") { person1++; }
if (value == "2") { person2++; }
if (value == "3") { person3++; }
if (value == "4") { person4++; }
if (value == "5") { person5++; }
if (value == "6") { person6++; }

Instead, I want (value == "4") to apply for BOTH person4 and person5, how would I go about doing this? Or could someone point me somewhere that would explain?

TIA,
mocha

Dude128
03-06-2003, 09:33 PM
you mean you want both person4 and person5 to be incremented when the user selects choice 4?

if so, then just use this:
if (value == "4") { person4++; person5++; }
in place of where it says if (value == "4") ...