建立XMLHTTP物件
function getHTTPRequestObject()
{
try
{
//試著建立舊版物件
xmlhttp = new ActiveXobject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
//試著建立IE物件
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch
{
xmlhttp = false;
}
}
if(!xmlhttp && typeof XMLHttpRequest!='underfinded')
{
//建立Mozilla or safari 原生物件
xmlhttp = new XMLHttpRequest();
}
}
{
try
{
//試著建立舊版物件
xmlhttp = new ActiveXobject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
//試著建立IE物件
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch
{
xmlhttp = false;
}
}
if(!xmlhttp && typeof XMLHttpRequest!='underfinded')
{
//建立Mozilla or safari 原生物件
xmlhttp = new XMLHttpRequest();
}
}