📄 createxmlhttprequest.js
字号:
// 创建XMLHttpRequest对象
function createXMLHttpRequest()
{
var xmlRequest = false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest)
{ //Mozilla 浏览器
xmlRequest = new XMLHttpRequest();
if (xmlRequest.overrideMimeType)
{//设置MiME类别
xmlRequest.overrideMimeType('text/xml');
}
}
else if (window.ActiveXObject)
{ // IE浏览器
try
{
xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
if (!xmlRequest)
{ // 异常,创建对象实例失败
window.alert("不能创建XMLHttpRequest对象实例.");
return false;
}
return xmlRequest;
}
//end XMLHttpRequest的创建
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -