|
|
Subject:
Troubleshoot Java quiz script
Category: Computers > Algorithms Asked by: cluelessone-ga List Price: $10.00 |
Posted:
10 Jul 2005 08:06 PDT
Expires: 09 Aug 2005 08:06 PDT Question ID: 541814 |
There is some problem with this quiz script. For some people it doesn't work correctly. I changed it a little so that if people submit more than once it still works, but still it doesn't work for some people. what is the bug? <!-- Begin var ans = new Array; var done = new Array; var yourAns = new Array; var explainAnswer = new Array; var score = 0; ans[1] = "c"; ans[2] = "a"; ans[3] = "c"; ans[4] = "c"; ans[5] = "d"; ans[6] = "c"; ans[7] = "b"; ans[8] = "a"; ans[9] = "d"; ans[10] = "b"; ans[11] = "b"; ans[12] = "a"; ans[13] = "d"; ans[14] = "c"; ans[15] = "d"; ans[16] = "a"; ans[17] = "a"; ans[18] = "b"; ans[19] = "c"; ans[20] = "d"; explainAnswer[1]="$$$"; .... explainAnswer[20]="$25"; function Engine(question, answer) { yourAns[question]=answer; } function Score(){ var score = 0; var answerText = "How did you do?\n------------------------------------\n"; for(i=1;i<=20;i++){ answerText=answerText+"\nQuestion "+i+" "; if(ans[i]!=yourAns[i]){ answerText=answerText+"The correct answer was "+ans[i]+": "+explainAnswer[i]+"\n"; } else{ answerText=answerText+" Correct! \n"; score++; } } answerText=answerText+"\n\nYour total score is : "+score+"\n"; //now score the user answerText=answerText+"\nComment : "; if(score<=10){ answerText=answerText+"You're completely unqualified"; } if(score>=11 && score <=14){ answerText=answerText+"You really should study up"; } if(score>=15 && score <=17){ answerText=answerText+"Not too bad"; } if(score>16){ answerText=answerText+"You're a genius!"; } alert(answerText); } // End --> </script> |
|
There is no answer at this time. |
|
Subject:
Re: Troubleshoot Java quiz script
From: r_mckenzie-ga on 21 Jul 2005 12:37 PDT |
You should make it clear that this is a JavaScript problem not a Java problem. - Post the context of the problem (i.e. full page) - Explain exactly the error you are getting |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |