//this technique hides the answers pretty
well from prying eyes
//the following contains the answers
var qset = new Array (1,2,0);
//total questions...
var tq = qset.length;
//total correct...
var tc = 0;
var score = 0;
//total answers...
var ta = 0;
//show answers - turn on or off as needed...
var sa = true;
function checkit( q , s) {
if (ta < tq) {
if (qset[q - 1] == s) {
tc++;
if (sa) {
alert("Correct");
}
}
else {
if (sa) {
alert("Incorrect answer!");
}
}
document.qform.tqbox.value = tq;
document.qform.tcbox.value = tc;
document.qform.scbox.value = ((tc / tq) * 100) + "%"
}
ta++;
}
|