I need to make an HTML page that has multiple choice quiz questions that
pull from an XML doc. I have been looking at various online examples of how
to do this, mainly this one: http://www.quirksmode.org/dom/importxml.html ,
but I can't get this damn thing working. Any help is appreciated, but if you
write out the html/javascript code you'll be my hero.
The example XML doc:
<?xml version="1.0" ?>
<quiz>
<question>
<ask>First question text?</ask>
<choice id="1000">First question first choice</choice>
<choice id="1001">First question second choice</choice>
<choice id="1002">First question third choice</choice>
<choice id="1003">First question fourth choice</choice>
</question>
<question>
<ask>Second question text?</ask>
<choice id="2000">Second question first choice</choice>
<choice id="2001">Second question second choice</choice>
<choice id="2002">Second question third choice</choice>
</question>
<question>
<ask>Third question text?</ask>
<choice id="3000">Third question first choice</choice>
<choiceid="3001"Third question second choice</choice>
<choice id="3002">Third question third choice</choice>
<choice id="3003">Third question fourth choice</choice>
<choice id="3004">Third question fifth choice</choice>
</question>
</quiz>
Should produce something like this:
<div id="quizcontent">
<div id="q1">
<p>Question 1</p>
<p>First question text?</p>
<input name="1000" id="1000" type="radio" value="" /><label
for="1000">First question first choice</label>
<input name="1001" id="1001" type="radio" value="" /><label
for="1001">First question second choice</label>
<input name="1002" id="1002" type="radio" value="" /><label
for="1002">First question third choice</label>
<input name="1003" id="1003" type="radio" value="" /><label
for="1003">First question fourth choice</label>
</div>
<div id="q2">
<p>Question 2</p>
<p>Second question text?</p>
<input name="2000" id="2000" type="radio" value="" /><label
for="1000">Second question first choice</label>
<input name="2001" id="2001" type="radio" value="" /><label
for="1001">Second question second choice</label>
<input name="2002" id="2002" type="radio" value="" /><label
for="1002">Second question third choice</label>
</div>
<div id="q3">
<p>Question 3</p>
<p>Third question text?</p>
<input name="3000" id="3000" type="radio" value="" /><label
for="3000">Third question first choice</label>
<input name="3001" id="3001" type="radio" value="" /><label
for="3001">Third question second choice</label>
<input name="3002" id="3002" type="radio" value="" /><label
for="3002">Third question third choice</label>
<input name="3003" id="3003" type="radio" value="" /><label
for="3003">Third question fourth choice</label>
<input name="3004" id="3004" type="radio" value="" /><label
for="3004">Third question fifth choice</label>
</div>
</div>