Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h2>My CD Collection:</h2>
<button type="button" onclick="loadXMLDoc()">
Get my CD collection</button>
<p id="demo"></p>
<script>
function loadXMLDoc() {
  var xmlhttp = new XMLHttpRequest();
  xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      myFunction(this);
    }
  };
  xmlhttp.open("GET.html", "cd_catalog.xml", true);
  xmlhttp.send();
}
function myFunction(xml) {
  var x, i, xmlDoc, txt;
  xmlDoc = xml.responseXML;
  txt = "";
  x = xmlDoc.getElementsByTagName("ARTIST");
  for (i = 0; i< x.length; i++) {
    txt += x[i].childNodes[0].nodeValue + "<br>";
  }
  document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/xml/tryit.asp?filename=try_dom_xmlhttprequest_responsexml by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 14:44:12 GMT -->
</html>