var xmlHttp = null;
var reobj = null;
function GetXmlHttpRequest(){
    var xmlHttp = null;
 try{
     //IE7,Mozilla,Safari,Firfox,Opera XmlHttpRequest
  xmlHttp = new XmlHttpRequest();
 }catch(e){
  try{
   xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
   try{
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }catch(e){
    xmlHttp = false;
   }
        }
 }
 return xmlHttp;
}
function sendRequest(){
 var province = document.getElementById("province").value;
    xmlHttp = GetXmlHttpRequest();//xmlHttp
 if(xmlHttp == null){
  return false;
 }

 var url = "z1.php";

 var poststr = "province="+province;

 xmlHttp.open("POST",url,true);

 xmlHttp.onreadystatechange = getResponse;

 xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

 xmlHttp.send(poststr);
}
function getResponse(){

    var flag = false;
    if((xmlHttp.readyState == 4)&&(xmlHttp.status == 200)){

  var city = xmlHttp.responseText.split(",");
  var count = city.length-1;
  if(count <= 0){
   document.getElementById(reobj).options[0] = new Option("--请选择--",0);
  }
  for(i = 0;i < count; i++){
   document.getElementById(reobj).options[i] = new Option(city[i],i);
  }
   }
}
function getclass(obj,obj1){
   document.getElementById(obj).innerHTML="<option>loading...</option>";
   sendRequest();
   reobj=obj;
  }

