|
 
- UID
- 304999
- 帖子
- 8295
- 精华
- 0
- 名声
- 166 分贝
- 探客币
- 1052 元
- 人品
- 50 %
- 阅读权限
- 250
|
1#
发表于 2008-3-18 15:58
| 只看该作者
帮忙看一段代码 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 不行 请各位帮忙分析一下 |
|