// JavaScript Document
//创建XMLHttpRequest对象
function createXMLHttpRequest(){ 
//用于存储XMLHttpRequest对象实例的函数 
var xmlHttp; 
//try程序段将适应除了IE6及其更早版本外的所有浏览器 
try 
{ 
xmlHttp = new XMLHttpRequest(); 
}//end try 
catch(e) 
{ 
//假设是IE6或其更早的版本 
var xmlHttpVersion=new Array("MSXML2.XMLHTTP.6.0", 
"MSXML2.XMLHTTP.5.0", 
"MSXML2.XMLHTTP.4.0", 
"MSXML2.XMLHTTP.3.0", 
"MSXML2.XMLHTTP", 
"Microsoft.XMLHTTP"); 
//顺序尝试创建每个对象，只到成功为止 
for(var i=0; i<xmlHttpVersion.length&&!xmlHttp; i++){ 
try 
{ 
//尝试创建xmlHttp对象 
xmlHttp=new ActiveXObject(xmlHttpVersion[i]); 
} 
catch(e) 
{} 
}//end for 
} 
//返回已经创建的对象，或显示错误信息 
if(!xmlHttp) 
{ 
alert("Error creating the XmlHttpRequest Object."); 
} 
else 
{ 
return xmlHttp; 
} 
} 

//异步(true)提交网址及参数

function posturl(theurl) {
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", theurl, true); //异步(true
	xmlHttp.send(null);
	//alert(xmlHttp.readyState);
	//alert(xmlHttp.status);
	//alert(xmlHttp.responseText+"qqqq");
}

//提交网页请求并返回文本结果,并写入到相应的块

function postget(theurl,thediv) {
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", theurl, false);
	xmlHttp.send(null);
	//alert(xmlHttp.readyState);
	//alert(xmlHttp.status);
	//alert(xmlHttp.responseText+"qqqq");
	var comm = document.getElementById(thediv);
	comm.innerHTML=xmlHttp.responseText;
}

function postget2(theurl,thediv) {
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", theurl, false);
	xmlHttp.send(null);
	var comm = document.getElementById(thediv);
	//alert(xmlHttp.status);
	comm.value=xmlHttp.responseText;
}
function postget1(theurl,thediv) {
	var xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", theurl, true);
	xmlHttp.send(null);
	var comm = document.getElementById(thediv);
	//alert("BB");
	//alert(xmlHttp.readyState);
	//alert(xmlHttp.status);
	//alert(xmlHttp.responseText);
	//comm.innerHTML=xmlHttp.responseText;
	xmlHttp.onreadystatechange = function() {
		//alert("DD");
		//alert(xmlHttp.readyState);
		if (xmlHttp.readyState == 4) { // loaded
		    //alert(xmlHttp.status);
			if (xmlHttp.status == 200) { // no http error
			    
				comm.innerHTML=xmlHttp.responseText;
			}
		}
	}
	//alert("EE");
}