Jump to content

Parse Xml In Js Not Working In Xampp With Ie9


Recommended Posts

<?xml version="1.0" encoding="utf-8"?><root><marquee>marquee 1</marquee><marquee>marquee 2</marquee><marquee>marquee 3</marquee><marquee>marquee 4</marquee><marquee>marquee 5</marquee><marquee>marquee 6</marquee><marquee>marquee 7</marquee><marquee>marquee 8</marquee><marquee>marquee 9</marquee><marquee>marquee 10</marquee></root>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script>function parseXML(method,xml,async){if(window.XMLHttpRequest){  xmlhttp = new XMLHttpRequest();  xmlhttp.open(method,xml,async);  xmlhttp.send();  }else {  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") ;  xmlhttp.async=async;  xmlhttp.load(xml);  }xmlDoc = xmlhttp.responseXML;}parseXML("GET","marquee.xml",false);function marquee(){for(var i=0; i<10; i++)document.getElementById("marquee").innerHTML += xmlDoc.getElementsByTagName("marquee")[i].childNodes[0].nodeValue+"<br />";}</script></head><body onload="marquee();"><marquee bgcolor="#FFFF99" width="300" height="100" id="marquee" behavior="scroll" direction="up" scrollamount="5"></marquee></body></html>

My problem is strange. When the address is:http://localhost/marquee.htmlIt works in both FF & IE. When the address is:C:\xampp\htdocs\marquee.htmlIt just works in FF.(I'm using XAMPP at present.) In IE Developer Tool,This line:

xmlhttp.open(method,xml,async);

is considered: access denied What does it mean? And how can I fix it?

Link to post
Share on other sites

Internet Explorer does not allow Asynchronous HTTP requests on the local filesystem. Just keep using localhost, there's nothing wrong with your code.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...