帮忙看一段代码 ajax
function UrlCont_OnClick(ID)
{
try
{
xRequest = getXMLHTTPRequest();
var xmlDom=getXMLDocument();
// xmlDom.loadXML("");
var domRoot= xmlDom.createElement("DataRoot");
xmlDom.appendChild(domRoot);
var node= xmlDom.createElement("data");
node.text=ID;
domRoot.appendChild(node);
xRequest.open("POST", "OnClick.aspx" ,true);
xRequest.send(xmlDom.xml);
}
catch(e)
{
document.writeln("Error name: " + e.name + "");
document.writeln("Error message: " + e.message);
}
xRequest.onreadystatechange=CallBackProcess;
}
function CallBackProcess()
{
}
function getXMLHTTPRequest()
{
var xRequest = null;
if(window.XMLHttpRequest)
{
xRequest = new XMLHttpRequest();
}
else if(typeof ActiveXObject != "undefined")
{
xRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
return xRequest;
}
function getXMLDocument()
{
var xDoc = null;
if(document.implementation && document.implementation.createDocument)
{
xDoc = document.implementation.createDocument("","",null);
}
else if(typeof ActiveXObject != "undefinded")
{
var msXmlAx = null;
try
{
msXmlAx = new ActiveXObject("Msxml2.DOMDocument");
}
catch(e)
{
msXmlAx = new ActiveXObject("Msxml.DOMDocument");
}
xDoc = msXmlAx;
}
if(xDoc == null || typeof xDoc.load =="undefined")
{
xDoc = null;
}
return xDoc;
}
IE可以 Firefox 不行 请各位帮忙分析一下
|