﻿// JavaScript Document

var xmlHttp;
function createXMLHttpRequest(){
   if(window.ActiveXObject) {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
   else if(window.XMLHttpRequest) {xmlHttp = new XMLHttpRequest();}
}

function startRequest(ip){
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("GET", "/common/fromIP.asp?ip="+ip, true);
	xmlHttp.setRequestHeader( "Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(null);
}

function handleStateChange(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			document.getElementById("fromIP").innerHTML=xmlHttp.responseText;
			xmlHttp=null;			
		}else{
			document.getElementById("fromIP").innerHTML="无法获取所在地！";
		}	
	}else{
		document.getElementById("fromIP").innerHTML='请稍候，正在获取中...';
	}	
}
