<%
'====================================================================
'功能：输出省份和城市
function exportProvice()
%>
<script language="javascript" defer="defer">
/*
说明：三级全国地区菜单
原创：恒星
*/
//封装一个xmlhttp与服务器端进行交互
		function ajax(objstr)
		{
			//接收传递参数
			string="objstr="+escape(objstr);
			//建立对象
			var objXMLHTTP = null;  
			try  
			{  
				objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP");  
			}  
			catch(e)  
			{  
				try  
				{  
					objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");  
				}  
				catch(e2){}
			} 
			//发送数据
			objXMLHTTP.open("POST", "inc/ajax.asp", false);
			objXMLHTTP.setrequestheader("content-length",string.length); 
			objXMLHTTP.setrequestheader("content-type","application/x-www-form-urlencoded"); 
			objXMLHTTP.send(string); 
			//得到服务器端返加值
			return objXMLHTTP.responseText;	
		}
		
		
		//封装返回省级数据
		function city(objstr,objselect)
		{
			var _Array=ajax(objstr);
			var objselect=eval("document.all."+objselect);
			//加入select值前先清空其所有值
			objselect.length=0;
			var split_Array=_Array.split("|");
			for(i=0;i<split_Array.length;i++)
			{
				objselect.options.add(new Option(split_Array[i],split_Array[i]));
			}
			
		}
		
		//封装返回Select选中值
		function getSelectValue(id)
		{
			var oSel = document.all(id);
			return oSel.options[oSel.selectedIndex].value;
		}
		
		//封装改变省级菜单产生事件city1
		function city1_change()
		{
			city(getSelectValue("city1"),"city2");
			city(getSelectValue("city2"),"city3");
		}
		
		//封装改变县级菜单产生事件city2
		function city2_change()
		{
			city(getSelectValue("city2"),"city3");
		}
		
		//第一次载入页面初始化select
		city("0","city1");
		city(getSelectValue("city1"),"city2");
		city(getSelectValue("city2"),"city3");
</script>
<select style="width: 80px;" id="city1" name="city1" onChange="city1_change();">
</select><select style="width: 80px;" id="city2" name="city2" onChange="city2_change();">
</select><div style="display:none;"><select id="city3" name="city3" ></select></div>
<%
end function

%>