To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.publish.htmlOpen lugnet.publish.html in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Publishing / HTML / 198
197  |  199
Subject: 
Re: Help With HTML
Newsgroups: 
lugnet.castle, lugnet.publish.html
Followup-To: 
lugnet.publish.html
Date: 
Fri, 18 Jan 2002 07:13:22 GMT
Viewed: 
91 times
  
In lugnet.castle, Jay Rodarte writes:
Hi. I need some sort of code that, when you answer questions, based on your
answers it will take you to another page. Like a quiz. Like if i asked you
"What's your favorite color, and you said green, it would take you to
1.html. But if you said blue it would take you to 2.html, does anyone know
what I mean? If so please help me.

I put a couple of short samples, both using javascript, that do what I think
you want at
http://home.earthlink.net/~jherre/test/select.html
which uses a select list for the answers, and
http://home.earthlink.net/~jherre/test/radio.html
which uses radio buttons for the answers.

The code for these is
<html>
<head>
  <title>choose a color</title>
  <script language="JavaScript">
   function gotoPage(selectPages) {
    var page=selectPages.options[selectPages.selectedIndex].value;

    if (page == " ") return;
    top.location=page;
   }
  </script>
</head>
<body>
  <form>
   <select onChange="gotoPage(this);">
    <option selected value=" ">choose a color
    <option value="red.html">red
    <option value="blue.html">blue
    <option value="green.html">green
   </select>
  </form>
</body>
</html>

and

<html>
<head>
  <title>choose a color</title>
  <script language="JavaScript">
   function gotoPage(radioButton) {
    var page=radioButton.value;

    top.location=page;
   }
  </script>
</head>
<body>
  <form>
   choose a color
   <input type=radio value="red.html" onClick="gotoPage(this);">red
   <input type=radio value="blue.html" onClick="gotoPage(this);">blue
   <input type=radio value="green.html" onClick="gotoPage(this);">green
  </form>
</body>
</html>



Message has 2 Replies:
  Re: Help With HTML
 
Thank you so much John, the site part I needed it for is up if you want to use it and see how it came to be. (...) (23 years ago, 18-Jan-02, to lugnet.publish.html)
  Re: Help With HTML
 
(...) <snip of John Herre's good, working code> Note that a Javascript implementation will only work for users who have Javascript turned on, so you need to either catch that somehow[1] or have a note on the page indicating the Javascript (...) (23 years ago, 18-Jan-02, to lugnet.publish.html)

Message is in Reply To:
  Help With HTML
 
Hi. I need some sort of code that, when you answer questions, based on your answers it will take you to another page. Like a quiz. Like if i asked you "What's your favorite color, and you said green, it would take you to 1.html. But if you said blue (...) (23 years ago, 18-Jan-02, to lugnet.castle)

6 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR