WebWeb - A Place to See Web Tricks and Techniques

Home FAQ's Resources Site Map Search Site Contact Us

Quizzes

Up
More Quizzes

Web Forms
Calculators
Quizzes
GuestBook
Message Board
Calendar
Members Only

 

 

Quiz Demonstration

1.  How many hours in a day? 22 hours
24 hours
26 hours
2.  How many days in a week? 5 days
6 days    
7 days
3.  What is the third month of the year? March    
May    
July
Quiz Results..
Total questions:
Total Correct: 
Score:

Background

bulletA separate include file (qsrc.js) is used to store the quiz results - this keeps the user from peaking at the source and getting the answer.
bulletThe quiz results could be sent to the server for for further evaluation.
bulletVarious layouts can be applied using this technique.

The following is the code from the qsrc.js file...

//this technique hides the answers pretty well from prying eyes
//the following contains the answers
var qset = new Array (1,2,0);

//total questions...
var tq = qset.length;
//total correct...
var tc = 0;
var score = 0;
//total answers...
var ta = 0;

//show answers - turn on or off as needed...
var sa = true;

function checkit( q , s) {
if (ta < tq) {
if (qset[q - 1] == s) {
tc++;
if (sa) {
alert("Correct");
}
}
else {
if (sa) {
alert("Incorrect answer!");
}
}
document.qform.tqbox.value = tq;
document.qform.tcbox.value = tc;
document.qform.scbox.value = ((tc / tq) * 100) + "%"
}
ta++;
}

 

 

  

 

    

 

   

 

 

Home ] More Quizzes ]
Copyright 2003-2005   - Dave Hillman   -   For Education Uses