
CodePudding user response:
<% @ page contentType="text/HTML. Charset=utf-8 "pageEncoding=" utf-8 "% & gt;<meta HTTP - equiv="content-type" content="text/HTML. Charset=utf-8 "/& gt;
<script type="text/javascript">
Var henan=[{value: the text: "zhengzhou", "zhengzhou"}, {value: the text: "luoyang", "luoyang"}, {value: the text: "kaifeng", "kaifeng"}, {value: the text: "xinyang", "xinyang"});
Var liaoning=[{value: the text: "shenyang", "shenyang"}, {value: the text: "dalian", "dalian"}, {value: the text: "jinzhou", "jinzhou"}, {the text: "dandong," value: "dandong"});
Var hebei=[{value: the text: "shijiazhuang", "shijiazhuang"}, {the text: "chengde," value: "chengde"}, {value: the text: "tangshan", "tangshan"}, {the text: "qinhuangdao," value: "qinhuangdao}");
Var shandong=[{value: the text: "jinan", "jinan"}, {value: the text: "Qingdao", "Qingdao"}, {value: the text: "weifang", "weifang"}, {value: the text: "yantai", "yantai"});
Var shannxi=[{value: the text: "xian", "xi 'an"}, {the text: "tongchuan," value: "tongchuan"}, {the text: "baoji," value: "baoji"}, {value: the text: "hanzhong city", "hanzhong"},
{value: the text: "yan", "yanan"}, {the text: "xianyang," value: "xianyang"}, {value: the text: "practical", "shangluo"}, {value: the text: "XingPing", "xingping"};
The function getCitys (val) {
If (val=="henan") return henan;
If (val=="hebei") return hebei;
If (val=="liaoning") return liaoning;
If (val=="shandong") return shandong;
If (val=="shannxi") return shannxi.
}
The function initCity (tag) {
//the tag represents prov drop-down list
Var ops=tag. The options;
Var independence idx=tag. SelectedIndex;
Var prov=ops [independence idx] value;//the selected provinces a
Var citys=getCitys (prov);
//iterate through group add content data to the city a drop-down list
Var citySelect=document. GetElementById (" city ");
For (var I=0; i
Var option=new option (citys [I] text, citys [I] value);
CitySelect. Options [I]=option;
}
}
</script>
<body>