wizi Posted May 16, 2010 Report Share Posted May 16, 2010 (edited) 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> Edited May 16, 2010 by wizi Link to comment Share on other sites More sharing options...
Ingolme Posted May 16, 2010 Report 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 Report Share Posted May 18, 2010 (edited) Thank you Ingolme, I run it on the server and it works perfect. Edited May 20, 2010 by wizi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now