Click to See Complete Forum and Search --> : what is wrong with this?


tecdoc5
06-21-2003, 02:13 PM
why does the explanation "That is correct" precede the score when i press the submit button? I don't want it to do this, I just want it to give the score upon submit. the onclick=checkans() is at the end of the html.

function CheckAns(question, answer) {
yourAns[question]=answer;
if(answer == ans[question]) {
alert("That is Correct!");
}
else {
alert("Incorrect!:"+ explainAnswer[question]);
}

CorrectNum=0
for(i=1; i<=10; i++) {
if(ans[i]==yourAns[i]) {CorrectNum++;}
}
alert("Your total score is "+CorrectNum+" out of
10.");
}

gil davis
06-21-2003, 03:04 PM
We would need to see the HTML for the form. Actually, it would be ideal if you could post a link to your page. It will save everyone a lot of headaches. If it isn't on the internet, then put it in a .txt or .zip file and attach it to your next post.