...
 
 
 

WhigWham's FREE online resources! Our WhigMCQ™ homepage ...

Click here to see this script do it's thing!Click here to see this script do it's thing!

Our WhigMCQ™ javascript is NOT associated with our "Do-It-All" WhigScript™ Set of javascripts, however it has been designed with that in mind as this script does save the user's final score into a small "Cookie" file on their hard-drive - making it easily retrievable for use in conjunction with The WhigScript™.

Indeed, you will find a working of this example where we have done just that, AND utilised one of the nice features of this script - the ability to handle multiple quizzes!

The WhigMCQ™ feature list includes:

        Efficiently handles multiple quizzes (on different pages).
        Shows the question number and number of questions remaining.
        Each quiz can have various numbers of answers per question!
        Can manage partial value answers.
        "Dummy" questions are also catered for!
        You can leave off (or add) answer elements as required for each of your quizzes, meaning WhigMCQ™ can handle almost ANY quiz - from simple true/false types to whatever you can think of! (well, almost anyway)

As the scripts stands, the ability to read the questions and answers from a standardised external text file means that a database-driven, "rotating" or multiple set/subset combinations should be possible. We hope (emphasis on the "hope") to achieve this in a future version of this script. Make sure you check back occasionally for the update!

WhigMCQ™ is FREE to download for personal AND commercial use (see the foot of this page for the full copyright details). We hope that you find this script is just as easy to configure as our other javascripts.

As always, if you encounter any difficulties installing or using our scripts, or if you would like to make any suggestions, requests, or constructive criticisms, please email us at "support@whigwham.com".

Just follow the simple steps shown below to use our WhigMail™ script in your own web page(s):

WhigMCQ™ Setup Instructions.
Step 1: You can include the WhigMCQ™ into your own page directly, between the <HEAD> and <BODY> tags in your HTML page like this:


Alternatively, you can save the script as an external file by adding an external script link like this:


The latter option is recommended for 3 reasons. Firstly, this means that your user's browser only ever needs to download the albeit small script file once into its cache, and not each time your user visits another of your pages that utilises this script. Second, you can then place this file in a hidden directory on your web server (a basic security technique that makes it harder for your users to cheat). Lastly, IT IS JUST EASIER!
Step 2: You then need to setup the 3 "components" of your page. If you not wish to use the default form/element names, however, you must edit the script directly (this is something that we also hope to address in a future version of this javascript).

Okay, the 3 "components" are ...

One
The first is easy - it is just a button (either form or image-based) that calls the initialise function like so:


Two
The second part is the most complicated, as this is the main question form. We use the term complicated loosely though, as even web design beginners should be able to set up this form.

Call the form "qtnForm", and set up the elements as shown in the example HTML code below:


A few things to note about the above form: First, the onChange/onFocus events applied to the text/textarea elements are just so the user cannot change what is displayed. Second, you can change the location of the two "display*" elements to wherever you like in the form. Lastly, the elements of this form can all be embedded into different parts of a table if it is wrapped by the form tag, Indeed, our working example of this script is heavily dependent on tables and CSS styles to give the quiz more visual impact.

Three
The third and "final" component is a single form (called "finalForm") with a single "text" or "textarea" element called "finalScore" like so:


NOTE: The element above has also been given the onFocus/onChange event combination, but the onChange event here has been slightly altered.
Step 3: If you download and open our WhigMCQ™ javascript in any text-editor, you will notice that we have divided the script into two parts, "A" and "B". You may ignore this if you are only intending on using this script as a single quiz, however if you are using this for multiple quizzes you can split this file into 2 separate parts. Part "B" is the common quiz functions, so call this something like "whigmcq_common.js". You should not need to change anything in this component unless you want to change the "base" cookie name, OR if you wish to change any of the names of the form components listed in step 2.

Part "A" contains the the array of questions and answers (explained in step 4), and the name of the test. This part is obviously specific to each test, but to save on download times, you can detach it and just include multiple part "A" mini scripts (call them something like "whigmcg_testname1.js") with only a single, common, part "B" script as above to work them all!

You must include these all separately within your HTML code (see step 1 for how to do this).
Step 4: The list of questions are included in the format "question", "answer1", value1, "answer2",value2, etc. for as many as you need i.e.. this can handle multiple numbers of answers with multiple values (0 for null answer, up to 1 for a full point). You will find them in the top part of the WhigMCQ™ javascript (in part "A") listed as separate sub-arrays like:


We think that this format would be easily compatible with most database applications (using custom headers and delimiters), and hope to cover this in a later update to this script.

Oh, as always javascript counts from zero so make sure that the first variable listed above is "qtn[0]".
Step 5: All done! Let the test begin ...
Double-click to install this item directly, or right-click and select "Save As" to save to your hard-drive.
Version:
1.0
Updated:
02-Oct-01

Click here to see this script do it's thing!Click here to see this script do it's thing!

Now why not check out our javascripts:

The WhigScript™ Set:
  WhigScript™ - the "Do-It-All" javascript!
  WhigShop™ - the shopping cart.
  WhigCredit™ - a credit card validator.
  WhigMail™ - the email solution.
Our other scripts:
  Not available yet, sorry.

The legal stuff:

 

 
Who is this guy? Find out more on our company information page...
Who is this guy? Find out more on our company information page...
 
Who is this guy? Find out more on our Company Information page...
Who is this guy? Find out more on our company information page...
Who is this guy? Find out more on our company information page...