| <html>
 <head>
  <script type="text/javascript">
   var xmlDoc;
   if ( window.XMLHttpRequest ) {
    xhttp = new XMLHttpRequest( );
   }
   else { // Internet Explorer 5/6
    xhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
   xhttp.open( "GET", "http://undcemcs01.und.edu/~wen.chen.hu/course/260/3/cd_catalog.xml", false );
   xhttp.send( "" );
   xmlDoc = xhttp.responseXML;
   var x = xmlDoc.getElementsByTagName("CD"); 
   i = 0;
   function next( ) {
    if ( i < x.length-1 ) {
     i++;
     display( );
    }
   }
   function previous( ) {
    if ( i > 0 ) {
     i--;
     display( );
    }
   }
   function display( ) {
    artist = (x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
    title  = (x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
    year   = (x[i].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue);
    document.getElementById("show").innerHTML =
      "Artist: " + artist + "Title: " + title + "Year: "+ year;
   }
  </script>
 </head>
 <body onload="display( )">
  <div id='show'></div><br />
  <input type="button" onclick="previous()" value="previous" />
  <input type="button" onclick="next()" value="next" />
 </body>
</html> |