none
an error about JavaScript RRS feed

  • 问题

  • <script type="text/javascript" language="javascript">
     function loadXMLDoc()
    {
    var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","AJAX.txt",true);
    xmlhttp.send();
    }
    </script>

    IN IE9:SCRIPT5:

    Error:拒绝访问。
    GET_1.html, 行26 字符1 .

    The error occurs in the line "xmlhttp.open("GET","AJAX.txt",true);".

    IN Chrome:The error is "XMLHttpRequest cannot load file:///D:/CSharp_Pratice/%E7%AC%AC%E5%9B%9B%E9%98%B6%E6%AE%B5%E7%BB%83%E4%B9%A0Html/AJAX/ajax.html. Cross origin requests are only supported for HTTP.".

     

     


    李东洋
    2011年12月26日 3:52

答案