Connecting Tech Pros Worldwide Help | Site Map

IE8 vs XML

Member
 
Join Date: Aug 2008
Posts: 40
#1: Aug 6 '09
Check out the following link.
http://mssportfolio.com/popup/
If u click on the "Add to cart" button,a pop up appears with some data retrieved from XML.The pop up works fine in Firefox but not with IE.The pop up appears in IE but not the data from xml file.what may be the problem?The script to retrieve xml code is as follows:

Expand|Select|Wrap|Line Numbers
  1. function loadXMLDoc(dname)
  2. {
  3. var xmlDoc;
  4.  
  5. if (window.XMLHttpRequest)
  6.   {
  7.   xmlDoc=new window.XMLHttpRequest();
  8.   xmlDoc.open("GET",dname,false);
  9.   xmlDoc.send("");
  10.   return xmlDoc.responseXML;
  11.   }
  12. // IE
  13. else if (ActiveXObject("Microsoft.XMLDOM"))
  14.   {
  15.   xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  16.   xmlDoc.async=false;
  17.   xmlDoc.load(dname);
  18.   return xmlDoc;
  19.   }
  20. alert("Error loading document");
  21. return null;
  22.  
  23. function display(id){
  24.  
  25. xmlDoc=loadXMLDoc("xmlfile.xml");
  26. x=xmlDoc.getElementsByTagName("LISTING")
  27. for(i=0;i<x.length;i++)
  28. {
  29. //document.write(x.item(i).attributes[0].textContent);
  30. //document.write("<br />");
  31. if(x.item(i).attributes[0].textContent==id){
  32.  
  33. document.getElementById('name').innerHTML=x.item(i).childNodes[1].childNodes[0].nodeValue;
  34. document.getElementById('author').innerHTML=x.item(i).childNodes[3].childNodes[0].nodeValue;
  35. document.getElementById('price').innerHTML=x.item(i).childNodes[5].childNodes[0].nodeValue;
  36. document.getElementById('publisher').innerHTML=x.item(i).childNodes[7].childNodes[0].nodeValue;
  37. document.getElementById('img').src=x.item(i).childNodes[9].childNodes[0].nodeValue;
  38.  
  39. }
  40.  
  41. }
Reply