﻿// 作者 洪石丹
var xmlHttp2;

function createXmlHttp()
{
	var activeKey=new Array("MSXML2.XMLHTTP.5.0",
	                       "MSXML2.XMLHTTP.4.0",
	                       "MSXML2.XMLHTTP.3.0",
	                       "MSXML2.XMLHTTP",
	                       "Microsoft.XMLHTTP");
	if(window.ActiveXObject)
	{
		for(var i=0;i<activeKey.length;i++)
		{
		    try
	        {
			    xmlHttp2=new ActiveXObject(activeKey[i]);
			    if(xmlHttp2!=null)
				    return xmlHttp2;
			}
	        catch(error)
	        {
		         continue;
	        } 
		}
		throw new Error("客户端浏览器版本过低，不支持XMLHttpRequest对象，请更新浏览器");
	}
	else if(window.XMLHttpRequest)
	{
		xmlHttp2=new window.XMLHttpRequest();
	}
}

function startRequestkey()
{
	xmlHttp2=createXmlHttp();
	
	xmlHttp2.onreadystatechange=readyStateChangeHandlerkey;
	//xmlHttp.open("GET",,null);
	var url="searchkeypage.aspx";
    xmlHttp2.open("post",url,true);
    //xmlHttp.SetRequestHeader ("Content-Type","text/xml; charset=gb2312");
	//xmlHttp.open("post",addUrlParameter(""),true);
	xmlHttp2.send(null);
}	

function readyStateChangeHandlerkey()
{
	if(xmlHttp2.readyState==4)
	{
		if(xmlHttp2.status==200)
		{
			var str=xmlHttp2.responseText;
			var div=document.getElementById("searchkey");
			div.innerHTML=str;
		}
	}
}
