Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old March 3rd, 2008, 05:18 PM   #1
New Member
 

Join Date: May 2004
Location: Kansas City
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 comaiwat is on a distinguished road
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
Attached Files
File Type: zip multi-quiz.zip (617 Bytes, 6 views)
comaiwat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 4th, 2008, 04:48 AM   #2
Reputable Member
 

Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 RohanShenoy is on a distinguished road
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.
Code:
if(totalscore=="100%")
{
window.location = "http://www.google.com/";
}
else
{
alert("Please take the quiz again");
window.reload();
}
RohanShenoy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 4th, 2008, 03:57 PM   #3
New Member
 

Join Date: May 2004
Location: Kansas City
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 comaiwat is on a distinguished road
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?
comaiwat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 6th, 2008, 11:47 AM   #4
New Member
 

Join Date: May 2004
Location: Kansas City
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 comaiwat is on a distinguished road
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.
comaiwat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript dharvesh JavaScript 4 October 20th, 2007 09:28 PM
quiz! alexgeek The Café 16 September 11th, 2007 03:01 PM
Interactive DVD with quiz Paula Graphic Specifics 3 October 4th, 2006 09:38 AM
Want code n template of online quiz s_mazhar PHP 2 August 31st, 2006 07:45 AM


Search Engine Optimization by vBSEO 3.2.0 RC8