xmlhttp ajax 异步传输
使用ajax方法调用外部页面,并作为页面的一个显示区域显示在页面上。
1
var xmlhttp
2
3
function RequestByGet(nProducttemp,nCountrytemp)
4
{
5
if (window.XMLHttpRequest)
6
{
7
//isIE = false;
8
xmlhttp = new XMLHttpRequest();
9
}
10
else if (window.ActiveXObject)
11
{
12
//isIE = true;
13
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
14
}
15
16
//Web page location.
17
var URL="/products/rightbarincludes/rightbarajax.asp?nProduct=" + nProducttemp + "&nCountry=" + nCountrytemp;
18
xmlhttp.open("GET",URL, true);
19
xmlhttp.onreadystatechange = handleResponse;
20
//xmlhttp.SetRequestHeader("Content-Type","text/html; charset=Shift_JIS")
21
xmlhttp.send(null);
22
}
23
24
function handleResponse()
25
{
26
if(xmlhttp.readyState == 4)
27
{
28
document.getElementById("div_RightBarBody").innerHTML=xmlhttp.responseText;
29
xmlhttp = null;
30
}
31
}
32
var xmlhttp2

3
function RequestByGet(nProducttemp,nCountrytemp)4
{5
if (window.XMLHttpRequest) 6
{ 7
//isIE = false; 8
xmlhttp = new XMLHttpRequest(); 9
} 10
else if (window.ActiveXObject)11
{ 12
//isIE = true; 13
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 14
}15
16
//Web page location.17
var URL="/products/rightbarincludes/rightbarajax.asp?nProduct=" + nProducttemp + "&nCountry=" + nCountrytemp;18
xmlhttp.open("GET",URL, true);19
xmlhttp.onreadystatechange = handleResponse;20
//xmlhttp.SetRequestHeader("Content-Type","text/html; charset=Shift_JIS")21
xmlhttp.send(null); 22
}23

24
function handleResponse()25
{26
if(xmlhttp.readyState == 4)27
{28
document.getElementById("div_RightBarBody").innerHTML=xmlhttp.responseText;29
xmlhttp = null;30
}31
}32




浙公网安备 33010602011771号