wizi Posted May 16, 2010 Share Posted May 16, 2010 Hi everyone, I need help with this Javascript and XML code. The script works fine with Chrome, Firefox but I got the error "Access is denied" when I try to run it on IE8 (on the line xhttp.open("GET","XML/events.xml",false); ) . Please help. Here is the code: <script type="text/javascript"> if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else // Internet Explorer 5/6 { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","XML/events.xml",false); xhttp.send(""); xmlDoc=xhttp.responseXML; var x=xmlDoc.getElementsByTagName("event"); for (i=0;i<x.length;i++) { document.write("<p class='textleft'>"); document.write("<img src=' " + x[i].getElementsByTagName("thumbnail")[0].childNodes[0].nodeValue + "' class='img-left'</>"); document.write("<strong class='text-1 br'>" + x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue + "</strong>"); //Title document.write("<br/>"); document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue); //Description document.write("<br/> <strong class='text-1'> Where: </strong>" + x[i].getElementsByTagName("where")[0].childNodes[0].nodeValue); document.write("<br/> <strong class='text-1'> When: </strong>" + x[i].getElementsByTagName("when")[0].childNodes[0].nodeValue); document.write("</p>"); document.write("<p class='sline'> </p>"); document.write("<p> </p>"); } </script> Link to comment Share on other sites More sharing options...
Ingolme Posted May 16, 2010 Share Posted May 16, 2010 If you're running this on your own cmputer, Internet Explorer's security settings might not allow access to other files.Try uploading it to a server. Link to comment Share on other sites More sharing options...
wizi Posted May 18, 2010 Author Share Posted May 18, 2010 Thank you Ingolme, I run it on the server and it works perfect. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.