function focus(){
	document.dform.word.focus();
}
function creatrequest(){
	var request = false;
	if(window.XMLHttpRequest) {
		request = new XMLHttpRequest();
		if(request.overrideMimeType) {
			request.overrideMimeType('text/xml');
		}
	} else if(window.ActiveXObject) {
		var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
		for(var i=0; i<versions.length; i++) {
			try {
				request = new ActiveXObject(versions[i]);
				if(request) {
					return request;
				}
			} catch(e) {
				//alert(e.message);
			}
		}
	}
	return request;
}

function sendRequestt(){
	if(document.dform.word.value.length>11){alert("无法识别超过12位数的手机号码"); }
	if(document.dform.word.value.length==7){dorequest(); }
	document.getElementById("phone").innerHTML = document.dform.word.value;
}
function onbuttom(){
	if(document.dform.word.value.length<7){alert("小于7个数字"); return false;}
	document.getElementById("phone").innerHTML = document.dform.word.value;
	dorequest();
}
function dorequest(){
	var request=creatrequest();
	var action=document.dform.word.value;
	var data="phone="+action;
	var url = "pajax.php";
	request.open("Post", url, true);
	request.onreadystatechange = updatePage;
	request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	request.send(data);
	function updatePage() {
		if (request.readyState == 1){
				document.getElementById("gsd").innerHTML = '查询中...';
		}
		if (request.readyState == 4){
			if (request.status == 200){
				var response = request.responseText;
//				alert(response);
				document.getElementById("gsd").innerHTML = response;
			}else{
				document.getElementById("gsd").innerHTML = '连接服务器失败！';
			}
		}
	}
}
