Kod
var pt=0;
function getQuestions() {
obj=document.getElementById("question");
obj.firstChild.nodeValue="(please wait)";
ajaxCallback = nextQuestion;
ajaxRequest("questions.xml");
}
function nextQuestion() {
questions = ajaxreq.responseXML.getElementsByTagName("q");
obj=document.getElementById("question");
if (pt < questions.length) {
q = questions[pt].firstChild.nodeValue;
obj.firstChild.nodeValue=q;
} else {
obj.firstChild.nodeValue="(no more questions)";
}
}
function getQuestions() {
obj=document.getElementById("question");
obj.firstChild.nodeValue="(please wait)";
ajaxCallback = nextQuestion;
ajaxRequest("questions.xml");
}
function nextQuestion() {
questions = ajaxreq.responseXML.getElementsByTagName("q");
obj=document.getElementById("question");
if (pt < questions.length) {
q = questions[pt].firstChild.nodeValue;
obj.firstChild.nodeValue=q;
} else {
obj.firstChild.nodeValue="(no more questions)";
}
}
Bardzo proszę o pomoc. Ten fragment skryptu nie działa, konkretnie nie pobiera danych z pliku questions.xml, który wygląda tak:
Kod
<?xml version="1.0" ?>
<questions>
<q>Pytanie</q>
</a>Odpowiedź</a>
</questions>
<questions>
<q>Pytanie</q>
</a>Odpowiedź</a>
</questions>

Pozdrawiam.