Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][XML]Pobieranie z xml
czernin
post
Post #1





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 14.06.2012

Ostrzeżenie: (0%)
-----


Mógłby mi ktoś wytłumaczyć, dlaczego to nie chce działać?

  1. <!DOCTYPE html>
  2. <h1>Posty</h1>
  3. <div>
  4. <b>Autor:</b> <span id="author"></span><br />
  5. <b>Data:</b> <span id="updated"></span><br />
  6. <b>Treść postu:</b> <span id="title"></span>
  7. </div>
  8.  
  9. <script type="text/javascript">
  10. if (window.XMLHttpRequest)
  11. {// code for IE7+, Firefox, Chrome, Opera, Safari
  12. xmlhttp=new XMLHttpRequest();
  13. }
  14. else
  15. {// code for IE6, IE5
  16. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  17. }
  18. xmlhttp.open("GET","http://exploration-base.blogspot.com/feeds/posts/default",false);
  19. xmlhttp.send();
  20. xmlDoc=xmlhttp.responseXML;
  21.  
  22. document.getElementById("author").innerHTML=
  23. xmlDoc.getElementsByTagName("author")[0].childNodes[0].nodeValue;
  24. document.getElementById("updated").innerHTML=
  25. xmlDoc.getElementsByTagName("updates")[0].childNodes[0].nodeValue;
  26. document.getElementById("message").innerHTML=
  27. xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;
  28.  
  29. </body>
  30. </html>


Kod
http://exploration-base.blogspot.com/feeds/posts/default


- Tam plik xml...
Go to the top of the page
+Quote Post

Posty w temacie


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: 24.08.2025 - 15:27