function loadXMLDoc(url) {
var xmlhttp;
var txt, x, xx, i;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
txt = "TitleArtistCOUNTRYCOMPANYPRICEYEAR";
x = xmlhttp.responseXML.documentElement.getElementsByTagName("CD");
for (i = 0; i
txt= txt+ "
";xx = x[i].getElementsByTagName("TITLE");
{
try {
txt = txt + "
" + xx[0].firstChild.nodeValue + "";}
catch (er) {
txt = txt + "
";}
}
xx = x[i].getElementsByTagName("ARTIST");
{
try {
txt = txt + "
" + xx[0].firstChild.nodeValue + "";}
catch (er) {
txt = txt + "
";}
}
xx = x[i].getElementsByTagName("COUNTRY");
{
try {
txt = txt + "
" + xx[0].firstChild.nodeValue + "";}
catch (er) {
txt = txt + "
";}
}
xx = x[i].getElementsByTagName("COMPANY");
{
try {
txt = txt + "
" + xx[0].firstChild.nodeValue + "";}
catch (er) {
txt = txt + "
";}
}
xx = x[i].getElementsByTagName("PRICE");
{
try {
txt = txt + "
" + xx[0].firstChild.nodeValue + "";}
catch (er) {
txt = txt + "
";}
}
xx = x[i].getElementsByTagName("YEAR");
{
try {
txt = txt + "
" + xx[0].firstChild.nodeValue + "";}
catch (er) {
txt = txt + "
";}
}
txt = txt + "
";}
txt = txt + "";
document.getElementById('txtCDInfo').innerHTML = txt;
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
获得 CD 信息