Web Analytics Made Easy -
StatCounter How do I make a quiz that will take people to different pages depending on the answer - CodingForum

Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I make a quiz that will take people to different pages depending on the answer

    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 . Please help!

  • #2
    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="javascriptickcolor('sky')">the sky</a>
    <a href="javascriptickcolor('sun')">the sun</a>
    </body>

    tell me if that isnt clear
    photoshop too expensive? use the GIMP! www.gimp.org

    Comment


    • #3
      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.


      Last edited by Catz228; Jun 22, 2002, 02:57 PM.

      Comment


      • #4
        well what kind of quiz are you looking for then?
        photoshop too expensive? use the GIMP! www.gimp.org

        Comment


        • #5
          Well, I was looking for something like this one http://violeteyes.org/tests/fruit/fruittest.html except I don't care about the colors.

          Comment


          • #6
            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
            photoshop too expensive? use the GIMP! www.gimp.org

            Comment

            Working...
            X