T
TPK
I have an HTML document with Javascript where I have a portion of the
page contents, a series of questions, being pulled from a XML file.
When the page dynamically builds all the questions and selection
choices are listed top down in the order they appear in the XML file.
Here is an example of the XML formatting:
<question type="single_answer">The text of a question.
<answer correct="no">A. Answer One
<user_feedback>Incorrect Answer</user_feedback>
</answer>
<answer correct="yes">B. Answer Two
<user_feedback>Incorrect Answer</user_feedback>
</answer>
</question>
As this stands, the entire contents of the XML file is displayed. If I
have 10 questions in the XML file, I get 10 questions being displayed
on the HTML file (in the same order they appear in the XML file). I
would like to have the HTML/Javascript select a random sub-set (and
order them randomly) of the questions rather than the entire contents.
For example, if I have 45 questions, I might like to have a displayed
sub-set of 20 questions that would change each time the page is loaded.
How could I use Javascript to randomly pull from an XML file?
Can anyone point me to instructions as to how to do that using
Javascript?
Links to any help would be appreciated. Thank you,
TPK
page contents, a series of questions, being pulled from a XML file.
When the page dynamically builds all the questions and selection
choices are listed top down in the order they appear in the XML file.
Here is an example of the XML formatting:
<question type="single_answer">The text of a question.
<answer correct="no">A. Answer One
<user_feedback>Incorrect Answer</user_feedback>
</answer>
<answer correct="yes">B. Answer Two
<user_feedback>Incorrect Answer</user_feedback>
</answer>
</question>
As this stands, the entire contents of the XML file is displayed. If I
have 10 questions in the XML file, I get 10 questions being displayed
on the HTML file (in the same order they appear in the XML file). I
would like to have the HTML/Javascript select a random sub-set (and
order them randomly) of the questions rather than the entire contents.
For example, if I have 45 questions, I might like to have a displayed
sub-set of 20 questions that would change each time the page is loaded.
How could I use Javascript to randomly pull from an XML file?
Can anyone point me to instructions as to how to do that using
Javascript?
Links to any help would be appreciated. Thank you,
TPK