View Full Version : Creating this?

08-06-2002, 09:40 PM
Hi everyone!
I saw this site with this on and I was wondering how I could do the same thing, with my own quizzes, ie, how to gather the input and make it go to the specified link, etc.
I cant really explain it so here's the link:


And basically, how?!

What's the process for making one of these?

I really appreciate the help


Thanks! :thumbsup:

08-06-2002, 09:56 PM
If you view the source on that page it's pretty much all there.

They define 4 variables (snowwhite, ariel, cinderella, belle) and increment these each by one for each answer that pertains to that subject. Then the variable with the highest number(score) is used to redirect the user to the appropriate HTML page.

08-06-2002, 10:01 PM
:D Thanks!

I'm probably being dense again, but how do you direct to the appropriate page?

08-06-2002, 10:03 PM
if something equals something, window.location.replace('urlgoeshere');

08-06-2002, 10:04 PM
Well, here's the code from that page that does it...
var out = "cinderella";
i = cinderella;
if (snowwhite> i) { out = "snowwhite"; i = snowwhite; }
if (ariel> i) { out = "ariel"; i = ariel; }
if (cinderella> i) { out = "cinderella"; i = cinderella; }
if (belle> i) { out = "belle"; i = belle; }
location.href = out + ".html";

08-06-2002, 10:08 PM
Thanks for helping a Javascript thicky :)

I think I've grasped the concept :D