![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 160 Pomógł: 4 Dołączył: 22.04.2006 Skąd: Kraków Ostrzeżenie: (0%) ![]() ![]() |
Mam mały problem z parsowaniem xml-a.
Mam pięć elementów w xml-u a musze podać że mam 10 i krok pętli zwiększyć do 2, żeby 'skakała' co 2. Nie rozumiem dlaczego sie tak dzieje (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) Poniżej daje kod. Kod function getHTML() { var url = 'test.xml'; var myAjax = new Ajax.Request( url, { onComplete: showResponse }); } function showResponse(originalRequest) { //$('mails').innerHTML = originalRequest.responseText; d = $("mails"); record = originalRequest.responseXML.getElementsByTagName("record"); for (i = 0; i < record.length; i++) { tr = document.createElement("tr"); td = document.createElement("td"); for (j = 1; j < 10; j+=2) { // w tej linii musiałem podwoić krok pętli td = document.createElement("td"); td.innerHTML = record[i].childNodes[j].childNodes[0].nodeValue; tr.appendChild(td); } d.appendChild(tr); } } test.xml
Dodam że problem jest chyba w przeglądarkach innych niż ie Ten post edytował yaro 30.07.2006, 17:57:25 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 23.08.2025 - 04:36 |