This is a discussion on "Javascript Quiz need some help" within the JavaScript Forum section. This forum, and the thread "Javascript Quiz need some help are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Javascript Quiz need some help
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Javascript Quiz need some help
Hi All,
I would like some help with this quiz I've downloaded. I really like the way it works, my only wish is to have the 100% quizer redirect to another webpage. Whomever did not make 100% will be sent to redo the quize and I think it does that already. It can be that once an alert box comes up to congratulate them, they then hit ok and it redirect them to the _self site with a new page. I try searching for ways to put link on an alert box but I don't think that's possible. Anyway if you could help that would be excellent. Thanks. Here is the link to the source codes. http://javascript.internet.com/misce...oice-quiz.html |
|
|
|
|||
|
Re: Javascript Quiz need some help
I haven't looked at the source files but you will have to insert the below snippet in the appropriate place.
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
|
|
|||
|
Re: Javascript Quiz need some help
I thought that this might be an appropriate place, but it's not working.
if(pc < 100) { if(confirm(alertMsg)) resetQuiz(false); { window.location = "http://www.google.com/"; } else return false; } else { alert(alertMsg); } Where should my snippet goes? |
|
|||
|
Re: Javascript Quiz need some help
Here is a snipplet of codes, what it does if if you take a quiz whether you pass the quiz or not
you get an alert box. If you get 100% an alert box pop ups with only the ok button. If you missed 1 on the quiz an alert box pop up with OK and Cancel. If you hit ok the page automatically refreshes to retake the quize. If you hit cancel nothing happen. How can I make a 100% alert box show a URL, is it possible? If not can an alert box OK buttons goes to redirect page? If so, what do I need to do for that to happen? function showScore() { if(answered != answers.length) { alert ("You have not answered all of the questions yet!"); return false; } questionCount = answers.length; correct = 0; incorrect = 0; for(i=0;i<questionCount;i++) { if(useranswers[i] == answers[i]) correct++; else incorrect++; } pc = Math.round((correct / questionCount) * 100); alertMsg = "You scored " + correct + " out of " + questionCount + "\n\n"; alertMsg += "You correctly answered " + pc + "% of the questions! \n\n"; if(pc == 100) alertMsg += response[0]; else if(pc >= 90) alertMsg += response[1]; else if(pc >= 70) alertMsg += response[2]; else if(pc > 50) alertMsg += response[3]; else if(pc >= 40) alertMsg += response[4]; else if(pc >= 20) alertMsg += response[5]; else if(pc >= 10) alertMsg += response[6]; else alertMsg += response[7]; if(pc < 100) { if(confirm(alertMsg)) resetQuiz(false); else return false; } else { alert(alertMsg); } } Please advise thank you in advance. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Javascript | dharvesh | JavaScript Forum | 4 | Oct 21st, 2007 01:28 |
| quiz! | alexgeek | Webforumz Cafe | 16 | Sep 11th, 2007 19:01 |
| Interactive DVD with quiz | Paula | Graphics and 3D | 3 | Oct 4th, 2006 13:38 |
| Want code n template of online quiz | s_mazhar | PHP Forum | 2 | Aug 31st, 2006 11:45 |