Categories:

Home / Free JavaScripts / Other / Here

Cut & Paste Instant-grading multiple choice quiz

Credit: JavaScript Kit

Description: A JavaScript quiz script with instant grading. The script can accommodate an unlimited number of questions, and is VERY easy to update, since all editing is done through an external data file.

Example:

JavaScript Kit Pop Quiz

Solution:

Your response:
Start Over Cheat Mode

Directions

Step 1: Save the following file into your web page directory by either clicking it, or clicking it with the shift key depressed for NS users (this is the file that contains the questions, solutions, etc).

Step 2: Insert the following code into the <body> section of your page where you want the quiz to appear:

Configuring the quiz: As mentioned above, all changes to the quiz is made in the external js file (popsolution.js). There are 4 steps to this process (You may want to have the file open right now).

Step 1: Change var total=5 in the first line to reflect the number of questions you're using.

Step 2: Change the text inside array compliments[] to reflect the phrases that will be randomly shown to the user if he/she correctly answers the question.

Step 3: This is the most important step- editing the questions. Each question follows the below format:

question[1]="What is the difference between a jungle and a rain forest?"
choice1[1]="No difference. Simply two different ways in referring to the same thing."
choice1[2]="A jungle in general receives less rain than a rain forest."
choice1[3]="A jungle refers to the thickest area of a rain forest"
choice1[4]="A jungle and a rain forest each contain their own group of distinct plants and animals."

Change the number in red to reflect the question number. The first line contains the actual question, the remaining lines the choices associated with the question.

Step 4: The final part is to change array solution[] to reflect the solution to each question.

You're done!


JavaScript Tools:
Site Info

CopyRight 1998-2014 JavaScript Kit. NO PART may be reproduced without author's permission.