here is my script, how can I write the script to have more than one possible answers?:
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var ans = new Array;
var done = new Array;
done[1] = false;
done[1] = false;
done[3] = false;
done[4] = false;
done[5] = false;
done[6] = false;
done[7] = false;
done[8] = false;
done[9] = false;
done[10] = false;
var score = 0;
ans[1] = "a";
ans[1] = "c";
ans[3] = "c";
ans[4] = "c";
ans[5] = "c";
ans[6] = "a";
ans[7] = "b";
ans[8] = "d";
ans[9] = "b";
ans[10] = "b";
function Engine(question, answer)
{
if (answer != ans[question])
{
if (done[question] == false)
{
alert("Nope. Your score stays at " + score+" points.");
}
else
{
alert("You have already answered this one.");
document.getElementById("quest"+question+"-"+ans[question]).checked = true;
}
//if(done[question] && )
/*else
{
alert("You have already answered this one.");
}*/
}
else
{
if (done[question] == false)
{
done[question] = true;
score++;
alert("Yes! Your score is now " + score+" points.");
}
else
{
alert("You have already answered this one.");
}
}
}
// End -->
</SCRIPT>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var ans = new Array;
var done = new Array;
done[1] = false;
done[1] = false;
done[3] = false;
done[4] = false;
done[5] = false;
done[6] = false;
done[7] = false;
done[8] = false;
done[9] = false;
done[10] = false;
var score = 0;
ans[1] = "a";
ans[1] = "c";
ans[3] = "c";
ans[4] = "c";
ans[5] = "c";
ans[6] = "a";
ans[7] = "b";
ans[8] = "d";
ans[9] = "b";
ans[10] = "b";
function Engine(question, answer)
{
if (answer != ans[question])
{
if (done[question] == false)
{
alert("Nope. Your score stays at " + score+" points.");
}
else
{
alert("You have already answered this one.");
document.getElementById("quest"+question+"-"+ans[question]).checked = true;
}
//if(done[question] && )
/*else
{
alert("You have already answered this one.");
}*/
}
else
{
if (done[question] == false)
{
done[question] = true;
score++;
alert("Yes! Your score is now " + score+" points.");
}
else
{
alert("You have already answered this one.");
}
}
}
// End -->
</SCRIPT>