Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ajax] Skrypt nie działa (?)
--void--
post
Post #1





Goście







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)";
   }
}


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>


(IMG:http://forum.php.pl/style_emoticons/default/blinksmiley.gif)

Pozdrawiam.
Go to the top of the page
+Quote Post

Posty w temacie
- -void-   [ajax] Skrypt nie działa (?)   12.10.2007, 19:47:11
- - drPayton   To co się natychmiast rzuca w oczy, to: [XML]...   12.10.2007, 22:49:08
- - -void-   Po prostu pomyliłem się przy przepisywaniu. Jeśli ...   13.10.2007, 16:08:07
- - -void-   ehh, jeszcze quiz.js Kod// zmienna globalna qn je...   13.10.2007, 16:09:11


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 16:50