因为我的表述不清造成了一些误解,下面我就将具体的问题联合案例文件一起发布出来,忘大家帮助解决。我的展示文件包括三个:
<!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=gb2312" /><title>Js_Test_1.html</title><script language="java-script1.5" type="text/java-script"><!--function AJAX(){var AJAXObj = null;if (window.XMLHttpRequest){AJAXObj = new XMLHttpRequest();if (AJAXObj.overrideMimeType){ AJAXObj.overrideMimeType("text/xml");}}else if (window.ActiveXObject){try{AJAXObj = new ActiveXObject("Msxml2.XMLHTTP.5.0");}catch (e){try{AJAXObj = new ActiveXObject("Msxml2.XMLHTTP.4.0");}catch (e){try{AJAXObj = new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch (e){try{AJAXObj = new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{AJAXObj = new ActiveXObject("Microsoft.XMLHTTP");}catch (e){}}}}}}if (!AJAXObj) { window.alert("不能创建 XMLHttpRequest 对象实例.");return false;}this.UserFunction = function (UserFunctionName){if (!UserFunctionName || UserFunctionName == null){alert("AJAX erro:\nUserFunctionName's value is null or false value.");return false;}AJAXObj.onreadystatechange = function (){if (AJAXObj.readyState == 4){ if(AJAXObj.status == 200){ eval(UserFunctionName);}else{ alert("您所请求的页面有异常。");}}}}this.Value = function (){return AJAXObj;}this.Send = function(Url,SendType,SendInfor){if (!Url || Url == null){alert("AJAX erro:\nUrl's value is null or false value.");return false;}if (!SendType || SendType == null || SendType !== "POST" || SendType !== "HEAD"){SendType = "GET";}if (!SendInfor || SendInfor == null){SendInfor = null;}AJAXObj.open(SendType,Url,true);if (SendInfor !== null){AJAXObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}AJAXObj.send(SendInfor);}this.Clean = function (){AJAXObj = null;}}//--></script></head>
<body><script language="java-script1.5" type="text/java-script"><!--function Result(){var XMLObj = AJAXTest.Value();alert("XMLObj = " + XMLObj.responseText);//读取属性值//var NodeName = "DefaultLanguage";//var XMLInfor = XMLObj.responseXML.getElementsByTagName(NodeName)[0].getAttribute("xml:lang");//读取节点值var NodeName = "AJAXTestInfor";var XMLInfor = XMLObj.responseXML.getElementsByTagName(NodeName)[0].firstChild.nodeValue;alert(NodeName + " = " + XMLInfor);}
var AJAXTest = new AJAX();AJAXTest.UserFunction("Result();");AJAXTest.Send("XML.asp","POST",null);//AJAXTest.Send("XML.xml","POST",null);//--></script></body></html>
<%@LANGUAGE="vb-script" CODEPAGE="936"%><%Response.Buffer = TrueResponse.Expires = 0%><?xml version="1.0" encoding="UTF-8"?><Languages><DefaultLanguage xml:lang="scn" /><Language xml:lang="en" EngName="English" LangName="English" Charset="Windows-1252" IsUse="False"><AJAXTestInfor>Are you sure quit?</AJAXTestInfor></Language><Language xml:lang="scn" EngName="SimpleChinese" LangName="SimpleChinese" Charset="Windows-1252" IsUse="True"><AJAXTestInfor>您确定要退出系统管理面板吗?</AJAXTestInfor></Language><Language xml:lang="tcn" EngName="TraditionalChinese" LangName="TraditionalChinese" Charset="Windows-1252" IsUse="False"><AJAXTestInfor>您確定要退出系統管理面板嗎?</AJAXTestInfor></Language></Languages>
<?xml version="1.0" encoding="UTF-8"?><Languages><DefaultLanguage xml:lang="scn" /><Language xml:lang="en" EngName="English" LangName="English" Charset="Windows-1252" IsUse="False"><AJAXTestInfor>Are you sure quit?</AJAXTestInfor></Language><Language xml:lang="scn" EngName="SimpleChinese" LangName="SimpleChinese" Charset="Windows-1252" IsUse="True"><AJAXTestInfor>您确定要退出系统管理面板吗?</AJAXTestInfor></Language><Language xml:lang="tcn" EngName="TraditionalChinese" LangName="TraditionalChinese" Charset="Windows-1252" IsUse="False"><AJAXTestInfor>您確定要退出系統管理面板嗎?</AJAXTestInfor></Language></Languages>
以上就是全部的三个范例文件。测试的时候,如果使用XML.xml文件作为数据源则可以正确的执行,但是如果使用XML.asp作为数据源,则在Firefox下可以正确执行,但在IE下则会报错,错误信息如下:
不知道为何原因,请高手、斑竹帮助,谢谢!