dwr provinces and two linkage

2010-08-15  来源:本站原创  分类:Web  人气:129 

1, Java code

private static Map <String, List <String>> provinceMap = new HashMap <String, List <String>> ();
private static String [] province = ("Hebei", "Shanxi", "Inner Mongolia", "Liaoning", "Jilin", "Heilongjiang"
"Jiangsu", "Zhejiang", "Anhui", "Fujian", "Jiangxi", "Shandong", "Henan", "Hubei", "Hunan", "Guangdong", "Guangxi"
"Hainan", "Sichuan", "Guizhou", "Yunnan", "Tibet", "Shaanxi", "Gansu", "Qinghai", "Ningxia", "Xinjiang", "Taiwan"
);
private static String [] [] city = (
("Shijiazhuang", "Tangshan", "Qinhuangdao", "Handan", "Xingtai", "Baoding", "Zhangjiakou", "Chengde", "Changzhou", "Langfang," "Hengshui")
("Taiyuan", "Datong", "Yangquan", "Changzhi", "Jincheng", "Shuozhou", "Jinzhong", "Lucky", "Xinzhou", "Linfen," "Luliang")
("Hohhot", "header", "Wuhai", "Chifeng," "Tongliao", "Erdos", "Hulunbeier", "Bayannur", "Ulanqab," "safety", "Xilin Gol" "Alex"),
("Shenyang", "Dalian", "Anshan", "Fushun", "Benxi", "Danton,", "Jinzhou", "Yingkou", "Fuxin," "Liaoyang", "Panjin," "Tieling" "Sunrise", "Huludao")
("Evergreen", "Jilin", "Siping", "Liaoyuan", "Tonghua", "Hakusan", "Matsubara", "White City", "Yanbian")
("Harbin", "Qiqihar", "Jixi", "Hegang", "Shuangyashan", "Daqing", "Yichun", "Jiamusi", "Qitaihe", "Mudanjiang", "Hei," " Suihua "," Daxinganling ")
("Nanjing", "Wuxi", "Xuzhou", "Changzhou", "Suzhou", "Nantong", "Lianyungang", "Huai", "Yancheng", "Yangzhou", "Zhenjiang," "Taizhou", " Suqian ")
("Hangzhou", "Ningbo", "Wenzhou", "Jiaxing", "Huzhou", "Shaoxing", "Jinhua", "Quzhou," "Zhoushan," "Taizhou", "Lishui")
("Hefei", "Wuhu", "Bengbu", "Huainan", "MOS", "Huaibei," "Ling", "Anqing", "Huang Shan", "Chuzhou", "Fuyang," "Suzhou", " Chaohu Lake "," Luan "," Bozhou "," Chizhou "," Xuancheng ")
("Fuzhou", "Xiamen", "Putian", "Sanming", "Quanzhou", "Zhangzhou," "Nanping," "Longyan," "Ningde")
("Nanchang", "Jingdezhen", "Pingxiang," "Jiujiang", "Xinyu", "Yingtan," "Ganzhou", "Jian", "Yichun", "Fuzhou", "Shangrao")
("Jinan", "Qingdao", "Zibo", "Zaozhuang," "Dongying," "Yantai", "Weifang", "Weihai", "Jining", "Tai", "sunshine", "Laiwu," " Linyi "," Texas "," NORMAL "," Binzhou "," Heze ")
("Zhengzhou", "Kaifeng", "Luoyang", "Pingdingshan", "Jiaozuo", "Hebi", "Xinxiang", "Anyang", "Puyang," "Xuchang," "Luohe", "Sanmenxia", " Nanyang "," Shangqiu "," Xinyang, "" Zhoukou "," Zhumadian ")
("Wuhan", "Yellowstone", "Xiangfan", "Shiyan", "Jingzhou", "Yichang", "Jingmen", "Ezhou", "Xiaogan", "Huanggang", "TEACHERS", "Suizhou" " Enshi ")
("Changsha", "Zhuzhou", "pattern", "Hengyang," "Shaoyang", "Yueyang", "Changde", "Zhangjiajie," "Yiyang," "Chenzhou", "Yongzhou", "TEACHERS", " Loudi, "" Western "),
("Guangzhou", "Shenzhen", "Zhuhai", "Shantou", "Shaoguan", "Foshan", "Jiangmen", "Zhanjiang", "Maoming," "Zhaoqing", "Huizhou", "Meizhou," " Shanwei "," Heyuan, "" Yangjiang "," Qingyuan "," Dongguan "," Zhongshan "," Chaozhou "," namely, the "," Yunfu ")
("Nanning", "Liuzhou", "Guilin", "Wuzhou," "North Sea", "Fangchenggang", "Yen Chow", "Sake", "Yulin", "Bose", "Hezhou", "Hechi" " Guest, "" Chongzuo "),
("Haikou", "Sanya")
("Chengdu", "Zigong," "Panzhihua", "Luzhou", "Deyang", "Mianyang", "Guangyuan", "Suining," "Neijiang," "Mountain", "Nanchong", "Yibin" " Kwong, "" Florida "," Meishan "," Ya "," Pakistan "," Ziyang "," Aba "," Ganzi, "" Liangshan ")
("Guiyang", "Liupanshui", "Zunyi", "Anshun", "Tongren," "Bijie," "Southwestern", "Southeast Guizhou", "Qiannan")
("Kunming", "Qujing", "Yuxi", "Baoshan", "Zhaotong," "Lijiang", "Puer," "Working hard," "mountain" and "Red River", "Xishuangbanna", "Chuxiong" "Dali", "Devon", "Nu", "Diqing")
("Lhasa", "Qamdo," "Nan," "Shigatse", "Nagqu," "Ali," "Nyingchi")
("Xi'an", "Tongchuan", "Baoji", "Xianyang," "Weinan" and "Yan", "Hanzhong", "Yulin", "well-being", "Shangluo")
("Lanzhou", "Jiayuguan," "Kim Chang", "silver", "Tianshui," "Wuwei", "Zhangye", "Pingliang", "Jiuquan", "Qingyang", "set the West", "Longnan" "Linxia", "Gannan")
("Xining", "Korean", "Haibei", "yellow South", "Hainan", "Guoluo", "Yushu", "Hercynian")
("Yinchuan", "Shizuishan", "Wu Zhong," "Guyuan", "defender")
("Urumqi", "Karamay", "Turpan", "Hami", "Wada", "Aksu", "Kashgar", "Jingpo", "Bayingolin Mongolia", "Changji" " Autonomous Mongolia "," Ili Kazakh "," Tacheng "," Altay ")
("Taipei", "Kaohsiung", "Keelung", "Taichung", "Tainan", "Hsinchu", "Chiayi")

);
static (
List <String> cityList = null;
for (int i = 0, j = province.length; i <j; i + +) (
cityList = new ArrayList <String> ();
provinceMap.put (province [i], cityList);
for (int m = 0, n = city [i]. length; m <n; m + +) (
cityList.add (city [i] [m]);
)
)
)
public String [] getProvince () (
return province;
)

public List <String> getCities (String provinceName) (
List <String> cityList = null;
if (provinceMap.containsKey (provinceName)) (
cityList = provinceMap.get (provinceName);
)
return cityList;
)

2, Javascript code

<script>
function init () (
a.getProvince (showProvince);
);
function showProvince (data) (
var province = document.form.province;
province.options [0] = new Option ('- Select Province Select Province','--');
for (var i = 0, j = data.length; i <j; i + +) (
province.options [i +1] = new Option (data [i], data [i]);
)
);
function showCities (data) (
var cities = document.form.cities;
for (var i = 0, j = data.length; i <j; i + +) (
cities.options [i] = new Option (data [i], data [i]);
)
)
function initCitySelect (provinceName) (
var ele = document.form.elements [1];
if (ele) (
document.form.removeChild (ele);
)
if ("- Select Province" == provinceName) (
return;
) Else (
var citiesSelect = document.createElement ("select");
citiesSelect.name = "cities";
document.form.appendChild (citiesSelect);
return a.getCities (provinceName, showCities);
)
)
</ Script>
</ Head>
<body onload="init()">
<form name="form">
<select name="province" onchange="initCitySelect(this.value)"> </ select>
</ Form>
</ Body>

相关文章
  • dwr provinces and two linkage 2010-08-15

    1, Java code private static Map <String, List <String>> provinceMap = new HashMap <String, List <String>> (); private static String [] province = ("Hebei", "Shanxi", "Inner Mongolia", "Liaoning&qu

  • Dwr done using a linkage function 2009-10-01

    Use ajax to do the dwr example of a functional linkage java method returns the list, list which is the entity public List <StuBean> getStu(String cID){ List <StuBean> list = new ArrayList <StuBean>(); StuBean stu = new StuBean(); stu.set

  • Provinces and three linkage 2010-04-16

    / / Provinces and three menu linkage function Dsy () ( this.Items = (); ) Dsy.prototype.add = function (id, iArray) ( this.Items [id] = iArray; ) Dsy.prototype.Exists = function (id) ( if (typeof (this.Items [id]) == "undefined") return false; r

  • Struts2 + Spring + Hibernate + DWR to achieve urban linkage 2010-06-25

    In the "DWR framework to use" article describes a basic overview of DWR and basic configuration. This took some time to achieve a Struts2 + Spring + Hibernate + DWR urban linkage to achieve a small item, I feel very useful. According to MVC hier

  • jquery + json - provinces and two linkage 2011-05-29

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untit

  • rails perfect realization of China's provinces, municipalities, three linkage 2010-11-30

    http://www.javaeye.com/topic/213838

  • (Turn) jQuery ajax populate select plug-ins 2008-08-26

    Note: This plug-in there is a conflict with jquery easyui, use this plug-in, easyui the datagrid will be ineffective in the singSelect Site: http://blog.csdn.net/luq885/archive/2007/07/31/1719538.aspx The first is ajax fill plug FillOptions, this plu

  • jQuery cascading drop-down list and related jar package and jquery json related plug-ins 2010-08-04

    First, ajax fill plug FillOptions, this plug-in method to get data via ajax and the data added to the drop-down list box, the data format support xml format and json format, plug-ins are defined as follows FillOptions (url, options) Parameter Descrip

  • DWR to achieve provincial cities and counties three linkage 2010-06-01

    Database design is about, a total of three fields [id, name, parentid], the name suggests, id is the only mark a record, name stored in the name of the provincial cities and counties, parentid stored in its parent's id, such as the province one level

  • Jquery provinces and cities based on two linkage 2010-01-03

    Jquery provinces and cities based on two linkage, downloaded directly to open inside the page, you can see the effects, both provincial and municipal data. . . .

  • js linkage other provinces 2010-04-18

    js provinces linkage

  • dwr achieve two linkage 2010-06-29

    Before finishing a moment to write a written code, written before the DWR to achieve the drop-down control two linkage 1. DWR use DWR to use is very simple to download dwr.jar package, configure WEB.xml <?xml version="1.0" encoding="UTF-

  • dwr example of linkage with the two 2010-08-13

    Recent projects using ajax to achieve a three-tier drop-down menu at the same time the user logs have also used the ajax, ajax looking Tongshi write code and found that he used a dwr, so taking the time today learned about dwr, write a two small exam

  • dwr drop-down box to achieve four linkage 2010-09-04

    Reluctant to 4 linkage to the buttoned up, the reason for that reluctance, because of the drop-down box, click the second time to refresh the page. Prior to linkage because there are two instances, it can be divided into two four drop-down box. The f

  • FLEX 3 linkage menu (provinces) 2010-09-27

    <? Xml version = "1.0" encoding = "utf-8"?> <mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" initialize="inti()"> <mx:Script> <! [CDATA [ public var province_text: String = "Select";

  • JavaScript html js 2 linkage regions, provinces and cities in the secondary linkage, provincial cities and counties js + xml 3 linkage 2009-05-06

    Comparison of two best linkage: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <MET

  • DWR three linkage 2009-08-10

    First of all, the introduction of the necessary js <script src=' The project name /dwr/interface/GetTrade.js'> </ script> to add the project name must be abnormal or <script src=' The project name /dwr/interface/GetArea.js'> </ script

  • DWR + Jquery linkage provincial and municipal 2010-05-05

    jsp code: <Script type = 'text / javascript' src ='<%= basePath%> dwr / interface / areaDwr.js'> </ script> <Script type = 'text / javascript' src ='<%= basePath%> dwr / engine.js'> </ script> <Script type = 'text /

  • jquery provinces three linkage 2010-09-06

    Very good interaction in addition to the three provinces of Liaoning Province and other provinces outside the region that may still not perfect region after it te get a little more get fixed up

  • xml refresh-free provinces to achieve the linkage code. rar 2010-06-15

    Test is still very full of hope and mutual exchange ASPX friends about, friends who need this program can download.