PDA

View Full Version : How do I make a quiz that will take people to different pages depending on the answer



Catz228
06-22-2002, 06:19 AM
Long title I know; sorry bout that. Anyway, I want to make a quiz that will take people to different pages depending on they're answers. Like if the quiz was which color is your favorite and there was questions like: What is your favorite thing on earth? A. The sky. B. The sun. Or C. The grass. And if the person picked the sky their favorite color would be blue and it would take them to a page saying their favorite color was blue. How do I do that? I've looked at codes from other people pages, but they are confusing because I have no idea how they work :confused: . Please help!
:(

whackaxe
06-22-2002, 11:15 AM
for a start make a page called blank.html and leave it blank(youll need it later)

now here the page you will hve the questions on(call it what you like)

<head>
<script>
function pickcolor(clr)
{

infowin = open("blank.html","","") //opening blank page

if (clr = "sky") // if function has been caled with clr as sky then....
{
infowin.document.write("your fav color is blue") //write your fav color is blue
}

else
if (clr = "sun")
{
infowin.document.write("your fav color is red") //same as last time exept with different color
}

}
</script>
</head>

<body>
<a href="javascript:pickcolor('sky')">the sky</a>
<a href="javascript:pickcolor('sun')">the sun</a>
</body>

tell me if that isnt clear

Catz228
06-22-2002, 03:39 PM
That's not the kind of quiz I was looking for. This one is just done with hyper links. Oh well, I can always just do a simple text quiz. That'll be easier anyway. Thanks for trying. :o


:) :o :p :thumbsup: :) :o :p

whackaxe
06-22-2002, 07:07 PM
well what kind of quiz are you looking for then?

Catz228
06-22-2002, 07:57 PM
Well, I was looking for something like this one http://violeteyes.org/tests/fruit/fruittest.html except I don't care about the colors.

whackaxe
06-22-2002, 09:35 PM
that is a real pain to check radio boxes and which are selected. you had better try to use combo boxes

<head>
<script>
function checkcolor()
{

clr = document.the_form.choice.options[the_form.choice.slectedIndex].value

if (clr = "sky")
{location.href = "blue.html"}
else
if (clr = "sun")
{location.href = "red.html"}

}
</script>
</head>

<body>

<form name="the_form">
<select name="choice">
<option value="sky">the sky</option>
<option value="sun">the sun</option>
<input type="button" value="send" onclick="checkcolor()">
</select>
</body>

that should help you out