1. Home
  2. Computing & Technology
  3. JavaScript

Quiz Maker 3 Script

4. Answer Head Script

Each answer page can display whatever information that you want about the correct answer that has just been selected. The only things that must go on each answer page are a small script that needs to go into the head of each answer page and a link to call the script to pass control back to the question page.

Select the code from the text box below (there is a highlight all button beneath it to make this easier) and copy it into a file called quizans.js.

You then link this code into the head of each answer page using the following code:

<script src="quizans.js"
type="text/javascript"></script>

The final step is to set up a link at the bottom of the answer page that will link to the next question. The code that you need looks like this:

<a href="javascript:quiz();">Next Question</a>

Note that this same script and link need to be placed into each answer page. The question and answer scripts between themselves will keep track of which question or answer page to display and how many questions have been answered correctly.

Question Body Script | Alternate Question Body Script | Question Head Script | Answer Head Script
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.