Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. function loadXMLDoc() {
  2. var xmlhttp = new XMLHttpRequest();
  3. xmlhttp.onreadystatechange = function() {
  4. if (this.readyState == 4 && this.status == 200) {
  5. myFunction(this);
  6. }
  7. };
  8. xmlhttp.open("GET", "cd_catalog.xml", true);
  9. xmlhttp.send();
  10. }
  11. function myFunction(xml) {
  12. var x, i, xmlDoc, txt;
  13. xmlDoc = xml.responseXML;
  14. txt = "";
  15. x = xmlDoc.getElementsByTagName("ARTIST");
  16. for (i = 0; i< x.length; i++) {
  17. txt += x[i].childNodes[0].nodeValue + "<br>";
  18. }
  19. document.getElementById("demo").innerHTML = txt;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement