時,我有下面的代碼放入一個函數,當函數被調用它加載我的XML文件,並將其顯示在消息框中:XMLHTTP狀態200消息中增加DOCTYPE到
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)
{
alert(xmlhttp.responseText);
} else
{
alert('Panel not communicating.Reason: '+xmlhttp.status);
}
}
xmlhttp.open("POST","myfile.xml",false);
xmlhttp.send();
上面的代碼一切都像它的意圖。
但是,只要我下面的代碼添加到頁面頂部:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
當我打開我的功能,它與下面的消息出現:
Panel not communicating.Reason: 200
然而
仍加載我的XML文件,就像我想要的一樣。
周圍搜索後稱,XMLHTTP狀態200的意思是「OK」
有誰知道爲什麼它顯示此消息?
我不能使用jQuery。我使用它,但我的設備太慢,無法加載jQuery js文件,所以我刪除它,現在它的加載速度很快,但現在我有這個問題。 – Aaron