javascript创建createXmlHttpRequest对象示例代码_javascript技巧
来源:动视网
责编:小采
时间:2020-11-27 21:19:25
javascript创建createXmlHttpRequest对象示例代码_javascript技巧
javascript创建createXmlHttpRequest对象示例代码_javascript技巧: 代码如下: var xmlHttp; function createXmlHttpRequest() { if(window.XMLHttpRequest) { xmlHttp=new XMLHttpRequest(); if(xmlHttp.overrideMimeType) { xmlHttp.overrideMimeType(text/xml
导读javascript创建createXmlHttpRequest对象示例代码_javascript技巧: 代码如下: var xmlHttp; function createXmlHttpRequest() { if(window.XMLHttpRequest) { xmlHttp=new XMLHttpRequest(); if(xmlHttp.overrideMimeType) { xmlHttp.overrideMimeType(text/xml

代码如下:
var xmlHttp;
function createXmlHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
if(xmlHttp.overrideMimeType)
{
xmlHttp.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
if(!xmlHttp)
{
window.alert("你的浏览器不支持创建XMLhttpRequest对象");
}
return xmlHttp;
}
javascript创建createXmlHttpRequest对象示例代码_javascript技巧
javascript创建createXmlHttpRequest对象示例代码_javascript技巧: 代码如下: var xmlHttp; function createXmlHttpRequest() { if(window.XMLHttpRequest) { xmlHttp=new XMLHttpRequest(); if(xmlHttp.overrideMimeType) { xmlHttp.overrideMimeType(text/xml