1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

XML in IE7+ help?

Discussion in 'XML & RSS' started by mokimofiki, Feb 7, 2011.

  1. #1
    First of all the following code works fine in Firefox, Chrome and Safari. Of course its IE that is having the issue (as always).

    Page Code:
    <script type="text/javascript">
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.open("GET","../../core/media/media.nl?id=65&c=1065162&h=e7c13890cb0064d02bb4&_xt=.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML;
    }
    
    document.write("<h3><a href=#>ROCK</a></h3><div>");
    document.write("<table width=100% cellspacing=0 cellpadding=3 border=0 id=rockprogram>");
    var x=xmlDoc.getElementsByTagName("ROCKPROGRAM");
    for (i=0;i<x.length;i++)
      { 
      document.write("<tr><td width=50 style='border-left: 1px solid #CCC; border-top: 1px solid #CCC;'>");
      document.write(x[i].getElementsByTagName("ADD")[0].childNodes[0].nodeValue);
      document.write("</td><td style='border-top: 1px solid #CCC;'>");
      document.write(x[i].getElementsByTagName("NAME")[0].childNodes[0].nodeValue);
      document.write("</td><td style='border-top: 1px solid #CCC;'>");
      document.write(x[i].getElementsByTagName("GENRE")[0].childNodes[0].nodeValue);
      document.write("</td><td style='border-top: 1px solid #CCC;'>");
      document.write(x[i].getElementsByTagName("DETAILS")[0].childNodes[0].nodeValue);
      document.write("</td><td width=300 style='border-right: 1px solid #CCC; border-top: 1px solid #CCC;'>");
      document.write(x[i].getElementsByTagName("PLAYER")[0].childNodes[0].nodeValue);
      document.write("</td></tr><tr><td colspan=5 style='border-top: 1px solid #CCC;'></td></tr>");
      }
    document.write("</table>");
    document.write("</div>");
    
    Code (markup):
    XML Code: (first couple items)
    <?xml version="1.0" encoding="utf-8"?>
    <CATALOG>
    	<ROCKPROGRAM>
    		<ADD>Add</ADD>
    		<NAME>Name</NAME>
    		<GENRE>Genre</GENRE>
    		<DETAILS>Details</DETAILS>
    		<PLAYER>Player</PLAYER>
    	</ROCKPROGRAM>
    	<ROCKPROGRAM>
    		<ADD>&lt;input type="checkbox" name="program" id="225" value="225"&gt;</ADD>
    		<NAME>Backpages</NAME>
    		<GENRE>Rock</GENRE>
    		<DETAILS>Details</DETAILS>
    		<PLAYER>&lt;p id="audioplayer_1" class="audio"&gt;Alternative content&lt;/p&gt; &lt;script type="text/javascript"&gt; AudioPlayer.embed("audioplayer_1", {soundFile: "http://music.muzak.com/content/programs/audio/8.mp3"});&lt;/script&gt;</PLAYER>
    	</ROCKPROGRAM>
    Code (markup):
     
    mokimofiki, Feb 7, 2011 IP