lundi 18 mars 2019

random not work if the question over 204 in xml

i have quiz game written by javascript and xml database for quetions like this:

<trivia>
    <quiz>
        <que>Aluminum</que>
        <ca>Al</ca>
        <ia>Am</ia>
        <ia>A</ia>
        <ia>Au</ia>
    <uinfo>Aluminum is available becouse petrole cheap.</uinfo>
    <diff>1</diff><rank>0</rank></quiz>
</trivia>

and this code in the game:

  // adds in quizzes each 'quiz' element with question (<que>), correct answer(<ca>), and incorrect answers(<ia>)
  quizzes[i]['que'] = arr_quiz[i].getElementsByTagName('que')[0].childNodes[0].nodeValue;      // question
  quizzes[i]['ca'] = arr_quiz[i].getElementsByTagName('ca')[0].childNodes[0].nodeValue;      // correct answer
  quizzes[i]['uinfo'] = arr_quiz[i].getElementsByTagName('uinfo')[0].childNodes[0].nodeValue;      // useful info

the quiz game work with 2 option (style):  Sequences question or random question.

Sequences questions work good, but when i selected (random question) the quiz game not work if:

the total number of questions in xml file over 204 questions.

or if the 3rd line in the code available (not stopped by "//"). when i stopped this 3rd line by // like:

//quizzes[i]['uinfo'] = arr_quiz[i].getElementsByTagName('uinfo')[0].childNodes[0].nodeValue; // useful info

the game work with unlimit quetions?!

please what is the problem ?




Aucun commentaire:

Enregistrer un commentaire