Quiz Maker 2 Script

The quiz JavaScript on this page processes multiple choice quizes having four possible answers to each question one of which is obviously the correct answer and the other three being wrong. You can have as many questions in the quiz as you require since with this version of the script you will be creating separate pages for each question. Unlike the one page version of the quiz maker script, this version does not provide a complete solution but instead provides the mechanism for displaying a quiz question while concealing which is the correct answer leaving the webmaster to decide how the questions should be linked together. Since the questions are handled separately there is also no mechanism for keeping score.

Although quizes are just for fun, it spoils the fun somewhat if it is possible to cheat. You will notice when you generate your quiz questions using the quiz maker that there is no single field identifying the correct answer that people will see if they view your page source. Instead there are two apparently random numbers that the script is able to use to work out the right answer when marking each question.

The first step in using this script is to obtain the Quiz JavaScript and attach it into the head of your page. To do this 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 quizhead.js.


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

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

The code contained in this script controls the display of the question and checking of answers.

Enter the questions and answers for your quiz into the form below. You need to indicate which answer is correct by selecting the radio button to the left of that answer. You also need to specify the pages that are to be linked to when the correct answer is selected and also when any of the wrong answers are selected. Once you have entered all of this information then select the "Create Question" button.

The script code for the question will appear in the text box below.

Answer One
Answer Two
Answer Three
Answer Four
Correct Answer
Wrong Answer
This entry contains HTML code.

You now add this question to the body section of the page where the question is to appear.

You will also need to create the pages that are to be displayed when the right and wrong answers are selected. You may wish to link directly from one correctly answered question to the next question page or alternatively you may wish to put a "correct answer" page in between. For the wrong answer page you might want to link back to the same question so that they can try again or alternatively just link to the next question in the quiz.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow