维科纳蒂 »
×
改变方向
在 Codepen 上打开
更改主题,深色/浅色
<!DOCTYPE html> <html> <body> <h2>Об’єкт XMLHttpRequest</h2> <p id="demo"></p> <script> const xhttp = new XMLHttpRequest(); xhttp.onload = function() { const xmlDoc = this.responseXML; const x = xmlDoc.getElementsByTagName("ARTIST"); let txt = ""; for (let i = 0; i < x.length; i++) { txt = txt + x[i].childNodes[0].nodeValue + "<br>"; } document.getElementById("demo").innerHTML = txt; } xhttp.open("GET", "cd_catalog.xml"); xhttp.send(); </script> </body> </html>