tecdoc5
06-20-2003, 12:53 PM
This code is for a project due in two days, I have to have popup boxes for two different buttons(submit and solutions).
I am posting the code that returns my needed info but it only works with one button and it is all on the same box. How can I separate the info?
I need total score under submit
and correct solutions under solutions.
I have all the other code set up for this.
Also in this code is the function engine () that is to return immediate feedback upon clicking the radio button. How do I need to write out this code to call the explanation for each question and not all questions together?
You can tell I am very new at this ! Help please.
function Engine(question, answer) {
yourAns[question]=answer; // give explanation for wrong answers
if (answer == ans[i]) {
alert ("Correct");
}
else {
alert(explainAnswer);
}
}
function CheckAns() { // submit button - show score
var CorrectNum = 0
}
function ShowAns(){ // solutions button - show all correct answers
var answerText ="";
for(i=1;i<=10;i++){
answerText=answerText+"\nQuestion :"+i+"\n"
if(ans[i]!=yourAns[i]){
answerText=answerText+"\nIncorrect!
"+explainAnswer[i]+"\n";
}
else{
answerText=answerText+" \nCorrect! \n";
score++;
}
}
answerText=answerText+"\n\nYour total score is :
"+score+" out of 10.\n";
alert(answerText);
}
I am posting the code that returns my needed info but it only works with one button and it is all on the same box. How can I separate the info?
I need total score under submit
and correct solutions under solutions.
I have all the other code set up for this.
Also in this code is the function engine () that is to return immediate feedback upon clicking the radio button. How do I need to write out this code to call the explanation for each question and not all questions together?
You can tell I am very new at this ! Help please.
function Engine(question, answer) {
yourAns[question]=answer; // give explanation for wrong answers
if (answer == ans[i]) {
alert ("Correct");
}
else {
alert(explainAnswer);
}
}
function CheckAns() { // submit button - show score
var CorrectNum = 0
}
function ShowAns(){ // solutions button - show all correct answers
var answerText ="";
for(i=1;i<=10;i++){
answerText=answerText+"\nQuestion :"+i+"\n"
if(ans[i]!=yourAns[i]){
answerText=answerText+"\nIncorrect!
"+explainAnswer[i]+"\n";
}
else{
answerText=answerText+" \nCorrect! \n";
score++;
}
}
answerText=answerText+"\n\nYour total score is :
"+score+" out of 10.\n";
alert(answerText);
}