SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random true/false quiz??

    Alright, here's what i want/trying to do:

    I need to take 17 different true/false questions and randomize them and choose 6 out of the 17.

    Then I need to go throught the 6 showing:
    1. The question.
    2. Then the correspondent answer depending if it's correct/incorrect.

    Then at the end of the total 6 the total correct needs to be tallied and if over a specific number then a specific result needs to be shown, else show another result.


    ----
    Any advice, ideas on this?

    Should i move this to the server-side forum?

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for a start put your questions and answers in an array

    PHP Code:

    var questionaire = new Array();
    var 
    answer = new Array();

    questionaire[0] = "ques 0";        answer[0] = true;
    questionaire[1] = "ques 1";        answer[1] = true;
    questionaire[2] = "ques 2";        answer[2] = true;
    questionaire[3] = "ques 3";        answer[3] = true;
    questionaire[4] = "ques 4";        answer[4] = true;
    questionaire[5] = "ques 5";        answer[5] = true;
    questionaire[6] = "ques 6";        answer[6] = true;
    questionaire[7] = "ques 7";        answer[7] = true;
    questionaire[8] = "ques 8";        answer[8] = true;
    questionaire[9] = "ques 9";        answer[9] = true;
    questionaire[10] = "ques 10";    answer[10] = true;
    questionaire[11] = "ques 11";    answer[11] = true;
    questionaire[12] = "ques 12";    answer[12] = true;
    questionaire[13] = "ques 13";    answer[13] = true;
    questionaire[14] = "ques 14";    answer[14] = true;
    questionaire[15] = "ques 15";    answer[15] = true;
    questionaire[16] = "ques 16";    answer[16] = true;
    questionaire[17] = "ques 17";    answer[17] = true
    use random to display a random number. but limit this in a for loop.

    and display it something like this


    PHP Code:

    for (a=0,b=17;a<=b;a++)
    {    
        
    with(document)
        {
            
    write (questionaire[a] + 
            
    '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
            
    'false<input type="radio" name="radiobutton''" value="radiobutton''" onclick="alert(value)" checked>' +
            
    'true<input type="radio" name="radiobutton''" value="radiobutton''" onclick="alert(value)"><br>');
        }

    how ever there are a lot of gaps in this as its very long winded. But have a look at grassblade that should get you going


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •