Javascript multiple quiz with a timer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kirara
    New Member
    • Dec 2006
    • 19

    #1

    Javascript multiple quiz with a timer

    Hi,

    I am new to javascript and I want to construct a quiz with five questions, and for each question there is a 3 choises, the user can only choose one answer (radio buttons) and for question there is only a 20 second to answer it before moving to the next question.

    my question is, how can I add a timer for each question and move to the next question when the time is 0,

    please I'll appreciate any help here :)
  • kirara
    New Member
    • Dec 2006
    • 19

    #2
    here my thoughts:

    //array of questions
    q = new Array()

    //array of answers
    a = new Array()
    //submitedAnswers
    aS = new Array()

    //timelimit of each question
    timeL = 20;

    //score
    score =0;
    // function to calculate the time
    function time(){
    }

    //function to check the submited answers against the a array

    function chechA(){
    count =0;
    for(count=0, count<q.length, count++){
    if(a[count]==aS[count]){
    score++
    }else{
    score --
    }

    //to go to the next window
    function goNext(){
    if(timeL==0)
    window.history. forward();
    }

    }

    those are my thoughts although I know they miss a lot of things...so any help

    Comment

    Working...