选择中国省市的控件

//选择中国省市的控件
    public class ChinaCitySelector:Control
    
{
        
private DropDownList ddlProvince=new DropDownList();
        
private DropDownList ddlCity=new DropDownList();
        
private Label lJscript=new Label();
        
private StringBuilder sbJscript=new StringBuilder();
        
private string _city="0";
        
private string _type="add";
        
private string client_province=null;
        
private string client_city=null;
        
private string client_function=null;


        
public string Province
        
{
            
get
            
{
                
if(ddlProvince.Page!=null)
                
{
                    SetProvince(ddlCity.Page.Request.Form[client_province].ToString().Trim());
                    SetCity(ddlCity.Page.Request.Form[client_city].ToString().Trim());
                    
return ddlCity.Page.Request.Form[client_province].ToString().Trim();
                }

                
else
                
{
                    
return ddlProvince.SelectedValue.ToString().Trim();
                }

            }


            
set
            
{
                SetProvince(value);
            }

        }

        
public string City
        
{
            
get
            
{
                
if(ddlCity.Page.Request.Form[client_city]!=null)
                
{
                    SetProvince(ddlCity.Page.Request.Form[client_province].ToString().Trim());
                    SetCity(ddlCity.Page.Request.Form[client_city].ToString().Trim());
                    
return ddlCity.Page.Request.Form[client_city].ToString().Trim();
                }

                
else
                
{
                    
return _city;
                }

            }

            
set
            
{
                _city
=value;
                SetCity(value);
            }

        }

        
public string type
        
{
            
get
            
{
                
return _type;
            }

            
set
            
{
                _type
=value;
                BindProvince();
                BindCity();
            }

        }

        

        
public ChinaCitySelector()
        
{
    
            

            Controls.Add(ddlProvince);
            Controls.Add(ddlCity);
            Controls.Add(lJscript);

            
//GenCode();
            
            
        }


        
public void GenCode()
        
{
            
string uniqueFlag=this.ID.ToString();

            ddlProvince.ID
="province"+uniqueFlag;
            ddlCity.ID
="city"+uniqueFlag;
            client_province
=ddlProvince.ID.ToString();
            client_city
=ddlCity.ID.ToString();
            client_function
="ChinaCitySelector"+uniqueFlag;
            BindProvince();
            BindCity();
            ddlProvince.SelectedIndex
=0;
            ddlProvince.Attributes.Add(
"OnChange",client_function+"_setcity("+client_province+","+client_city+");");
        }



        
private void SetProvince(string province)
        
{
            ddlProvince.ClearSelection();
            
if(ddlProvince.Items.FindByValue(province)!=null)ddlProvince.Items.FindByValue(province).Selected=true;
            lJscript.Text
+="<script language='JavaScript'>"+client_function+"_setcity(myForm."+client_province+",myForm."+client_city+");</script>";
            
            
        }

        
private void SetCity(string city)
        
{
            
            lJscript.Text
+="<script language='JavaScript'>\n";
            lJscript.Text
+="for(var i = 0; i <myForm."+client_city+".length; i++)\n";
            lJscript.Text
+="{\n    if(myForm."+client_city+".options[i].value==\""+city+"\")myForm."+client_city+".selectedIndex = i;\n}\n";
            lJscript.Text
+="</script>";
            
        }



        
private void BindProvince()
        
{
            ddlProvince.Items.Clear();
            
if(type=="add")
            
{
                ddlProvince.Items.Add(
new ListItem("选择所在省份","0"));
            }

            
else
            
{
                ddlProvince.Items.Add(
new ListItem("所有省份","0"));
            }

            ddlProvince.Items.Add(
new ListItem("北京","北京"));
            ddlProvince.Items.Add(
new ListItem("上海","上海"));
            ddlProvince.Items.Add(
new ListItem("重庆","重庆"));
            ddlProvince.Items.Add(
new ListItem("福建","福建"));
            ddlProvince.Items.Add(
new ListItem("甘肃","甘肃"));
            ddlProvince.Items.Add(
new ListItem("广东","广东"));
            ddlProvince.Items.Add(
new ListItem("广西","广西"));
            ddlProvince.Items.Add(
new ListItem("贵州","贵州"));
            ddlProvince.Items.Add(
new ListItem("海南","海南"));
            ddlProvince.Items.Add(
new ListItem("河北","河北"));
            ddlProvince.Items.Add(
new ListItem("黑龙江","黑龙江"));
            ddlProvince.Items.Add(
new ListItem("河南","河南"));
            ddlProvince.Items.Add(
new ListItem("湖北","湖北"));
            ddlProvince.Items.Add(
new ListItem("湖南","湖南"));
            ddlProvince.Items.Add(
new ListItem("江苏","江苏"));
            ddlProvince.Items.Add(
new ListItem("安徽","安徽"));
            ddlProvince.Items.Add(
new ListItem("江西","江西"));
            ddlProvince.Items.Add(
new ListItem("吉林","吉林"));
            ddlProvince.Items.Add(
new ListItem("辽宁","辽宁"));
            ddlProvince.Items.Add(
new ListItem("内蒙古","内蒙古"));
            ddlProvince.Items.Add(
new ListItem("宁夏","宁夏"));
            ddlProvince.Items.Add(
new ListItem("青海","青海"));
            ddlProvince.Items.Add(
new ListItem("山东","山东"));
            ddlProvince.Items.Add(
new ListItem("山西","山西"));
            ddlProvince.Items.Add(
new ListItem("陕西","陕西"));
            ddlProvince.Items.Add(
new ListItem("四川","四川"));
            ddlProvince.Items.Add(
new ListItem("天津","天津"));
            ddlProvince.Items.Add(
new ListItem("新疆","新疆"));
            ddlProvince.Items.Add(
new ListItem("西藏","西藏"));
            ddlProvince.Items.Add(
new ListItem("云南","云南"));
            ddlProvince.Items.Add(
new ListItem("浙江","浙江"));
            ddlProvince.Items.Add(
new ListItem("香港","香港"));
            ddlProvince.Items.Add(
new ListItem("澳门","澳门"));
            ddlProvince.Items.Add(
new ListItem("台湾","台湾"));
        }

        
        
private void BindCity()
        
{
            sbJscript.Remove(
0,sbJscript.Length);
            sbJscript.Append(
"<SCRIPT LANGUAGE=\"JavaScript\" >\n");
            sbJscript.Append(
"<!--\n");
            sbJscript.Append(
"function "+client_function+"_setcity(province,city) {\n");
            sbJscript.Append(
"switch (province.options[province.selectedIndex].value) {\n");
            sbJscript.Append(
"case \"\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array(\"\", \"\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"安徽\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array(\n");
            sbJscript.Append(
"    \"合肥(*)\", \"合肥\",\n");
            sbJscript.Append(
"    \"安庆\", \"安庆\",\n");
            sbJscript.Append(
"    \"蚌埠\", \"蚌埠\",\n");
            sbJscript.Append(
"    \"亳州\", \"亳州\",\n");
            sbJscript.Append(
"    \"巢湖\", \"巢湖\",\n");
            sbJscript.Append(
"    \"滁州\", \"滁州\",\n");
            sbJscript.Append(
"    \"阜阳\", \"阜阳\",\n");
            sbJscript.Append(
"    \"贵池\", \"贵池\",\n");
            sbJscript.Append(
"    \"淮北\", \"淮北\",\n");
            sbJscript.Append(
"    \"淮化\", \"淮化\",\n");
            sbJscript.Append(
"    \"淮南\", \"淮南\",\n");
            sbJscript.Append(
"    \"黄山\", \"黄山\",\n");
            sbJscript.Append(
"    \"九华山\", \"九华山\",\n");
            sbJscript.Append(
"    \"六安\", \"六安\",\n");
            sbJscript.Append(
"    \"马鞍山\", \"马鞍山\",\n");
            sbJscript.Append(
"    \"宿州\", \"宿州\",\n");
            sbJscript.Append(
"    \"铜陵\", \"铜陵\",\n");
            sbJscript.Append(
"    \"屯溪\", \"屯溪\",\n");
            sbJscript.Append(
"    \"芜湖\", \"芜湖\",\n");
            sbJscript.Append(
"    \"宣城\", \"宣城\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"北京\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"北京\", \"北京\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"重庆\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"重庆\", \"重庆\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"福建\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"福州(*)\", \"福州\",\n");
            sbJscript.Append(
"    \"福安\", \"福安\",\n");
            sbJscript.Append(
"    \"龙岩\", \"龙岩\",\n");
            sbJscript.Append(
"    \"南平\", \"南平\",\n");
            sbJscript.Append(
"    \"宁德\", \"宁德\",\n");
            sbJscript.Append(
"    \"莆田\", \"莆田\",\n");
            sbJscript.Append(
"    \"泉州\", \"泉州\",\n");
            sbJscript.Append(
"    \"三明\", \"三明\",\n");
            sbJscript.Append(
"    \"邵武\", \"邵武\",\n");
            sbJscript.Append(
"    \"石狮\", \"石狮\",\n");
            sbJscript.Append(
"    \"永安\", \"永安\",\n");
            sbJscript.Append(
"    \"武夷山\", \"武夷山\",\n");
            sbJscript.Append(
"    \"厦门\", \"厦门\",\n");
            sbJscript.Append(
"    \"漳州\", \"漳州\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"甘肃\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"兰州(*)\", \"兰州\",\n");
            sbJscript.Append(
"    \"白银\", \"白银\",\n");
            sbJscript.Append(
"    \"定西\", \"定西\",\n");
            sbJscript.Append(
"    \"敦煌\", \"敦煌\",\n");
            sbJscript.Append(
"    \"甘南\", \"甘南\",\n");
            sbJscript.Append(
"    \"金昌\", \"金昌\",\n");
            sbJscript.Append(
"    \"酒泉\", \"酒泉\",\n");
            sbJscript.Append(
"    \"临夏\", \"临夏\",\n");
            sbJscript.Append(
"    \"平凉\", \"平凉\",\n");
            sbJscript.Append(
"    \"天水\", \"天水\",\n");
            sbJscript.Append(
"    \"武都\", \"武都\", \n");
            sbJscript.Append(
"    \"西峰\", \"西峰\", \n");
            sbJscript.Append(
"    \"张掖\", \"张掖\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"广东\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"广州(*)\", \"广州\",\n");
            sbJscript.Append(
"    \"潮阳\", \"潮阳\",\n");
            sbJscript.Append(
"    \"潮州\", \"潮州\",\n");
            sbJscript.Append(
"    \"澄海\", \"澄海\",\n");
            sbJscript.Append(
"    \"东莞\", \"东莞\",\n");
            sbJscript.Append(
"    \"佛山\", \"佛山\",\n");
            sbJscript.Append(
"    \"河源\", \"河源\",\n");
            sbJscript.Append(
"    \"惠州\", \"惠州\",\n");
            sbJscript.Append(
"    \"江门\", \"江门\",\n");
            sbJscript.Append(
"    \"揭阳\", \"揭阳\",\n");
            sbJscript.Append(
"    \"开平\", \"开平\",\n");
            sbJscript.Append(
"    \"茂名\", \"茂名\",\n");
            sbJscript.Append(
"    \"梅州\", \"梅州\",\n");
            sbJscript.Append(
"    \"清远\", \"清远\",\n");
            sbJscript.Append(
"    \"汕头\", \"汕头\",\n");
            sbJscript.Append(
"    \"汕尾\", \"汕尾\",\n");
            sbJscript.Append(
"    \"韶关\", \"韶关\",\n");
            sbJscript.Append(
"    \"深圳\", \"深圳\",\n");
            sbJscript.Append(
"    \"顺德\", \"顺德\",\n");
            sbJscript.Append(
"    \"阳江\", \"阳江\",\n");
            sbJscript.Append(
"    \"阳江\", \"阳江\",\n");
            sbJscript.Append(
"    \"英德\", \"英德\",\n");
            sbJscript.Append(
"    \"云浮\", \"云浮\",\n");
            sbJscript.Append(
"    \"增城\", \"增城\",\n");
            sbJscript.Append(
"    \"湛江\", \"湛江\",\n");
            sbJscript.Append(
"    \"肇庆\", \"肇庆\", \n");
            sbJscript.Append(
"    \"中山\", \"中山\", \n");
            sbJscript.Append(
"    \"珠海\", \"珠海\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"广西\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"南宁(*)\", \"南宁\",\n");
            sbJscript.Append(
"    \"百色\", \"百色\",\n");
            sbJscript.Append(
"    \"北海\", \"北海\",\n");
            sbJscript.Append(
"    \"桂林\", \"桂林\",\n");
            sbJscript.Append(
"    \"防城港\", \"防城港\",\n");
            sbJscript.Append(
"    \"河池\", \"河池\",\n");
            sbJscript.Append(
"    \"柳州\", \"柳州\",\n");
            sbJscript.Append(
"    \"钦州\", \"钦州\", \n");
            sbJscript.Append(
"    \"梧州\", \"梧州\", \n");
            sbJscript.Append(
"    \"玉林\", \"玉林\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"贵州\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"贵阳(*)\", \"贵阳\",\n");
            sbJscript.Append(
"    \"安顺\", \"安顺\",\n");
            sbJscript.Append(
"    \"毕节\", \"毕节\",\n");
            sbJscript.Append(
"    \"都匀\", \"都匀\",\n");
            sbJscript.Append(
"    \"凯里\", \"凯里\",\n");
            sbJscript.Append(
"    \"六盘水\", \"六盘水\",\n");
            sbJscript.Append(
"    \"铜仁\", \"铜仁\",\n");
            sbJscript.Append(
"    \"兴义\", \"兴义\", \n");
            sbJscript.Append(
"    \"玉屏\", \"玉屏\", \n");
            sbJscript.Append(
"    \"遵义\", \"遵义\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"海南\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"海口(*)\", \"海口\",\n");
            sbJscript.Append(
"    \"儋县\", \"儋县\",\n");
            sbJscript.Append(
"    \"陵水\", \"陵水\",\n");
            sbJscript.Append(
"    \"琼海\", \"琼海\",\n");
            sbJscript.Append(
"    \"三亚\", \"三亚\",\n");
            sbJscript.Append(
"    \"通什\", \"通什\",\n");
            sbJscript.Append(
"    \"万宁\", \"万宁\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"河北\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"石家庄(*)\", \"石家庄\",\n");
            sbJscript.Append(
"    \"保定\", \"保定\",\n");
            sbJscript.Append(
"    \"北戴河\", \"北戴河\",\n");
            sbJscript.Append(
"    \"沧州\", \"沧州\",\n");
            sbJscript.Append(
"    \"承德\", \"承德\",\n");
            sbJscript.Append(
"    \"丰润\", \"丰润\",\n");
            sbJscript.Append(
"    \"邯郸\", \"邯郸\",\n");
            sbJscript.Append(
"    \"衡水\", \"衡水\",\n");
            sbJscript.Append(
"    \"廊坊\", \"廊坊\",\n");
            sbJscript.Append(
"    \"南戴河\", \"南戴河\",\n");
            sbJscript.Append(
"    \"秦皇岛\", \"秦皇岛\",\n");
            sbJscript.Append(
"    \"唐山\", \"唐山\",\n");
            sbJscript.Append(
"    \"新城\", \"新城\",\n");
            sbJscript.Append(
"    \"邢台\", \"邢台\", \n");
            sbJscript.Append(
"    \"张家口\", \"张家口\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"黑龙江\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"哈尔滨(*)\", \"哈尔滨\",\n");
            sbJscript.Append(
"    \"北安\", \"北安\",\n");
            sbJscript.Append(
"    \"大庆\", \"大庆\",\n");
            sbJscript.Append(
"    \"大兴安岭\", \"大兴安岭\",\n");
            sbJscript.Append(
"    \"鹤岗\", \"鹤岗\",\n");
            sbJscript.Append(
"    \"黑河\", \"黑河\",\n");
            sbJscript.Append(
"    \"佳木斯\", \"佳木斯\",\n");
            sbJscript.Append(
"    \"鸡西\", \"鸡西\",\n");
            sbJscript.Append(
"    \"牡丹江\", \"牡丹江\",\n");
            sbJscript.Append(
"    \"齐齐哈尔\", \"齐齐哈尔\",\n");
            sbJscript.Append(
"    \"七台河\", \"七台河\",\n");
            sbJscript.Append(
"    \"双鸭山\", \"双鸭山\",\n");
            sbJscript.Append(
"    \"绥化\", \"绥化\",\n");
            sbJscript.Append(
"    \"伊春\", \"伊春\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"河南\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"郑州(*)\", \"郑州\",\n");
            sbJscript.Append(
"    \"安阳\", \"安阳\",\n");
            sbJscript.Append(
"    \"鹤壁\", \"鹤壁\",\n");
            sbJscript.Append(
"    \"潢川\", \"潢川\",\n");
            sbJscript.Append(
"    \"焦作\", \"焦作\",\n");
            sbJscript.Append(
"    \"开封\", \"开封\",\n");
            sbJscript.Append(
"    \"漯河\", \"漯河\",\n");
            sbJscript.Append(
"    \"洛阳\", \"洛阳\",\n");
            sbJscript.Append(
"    \"南阳\", \"南阳\",\n");
            sbJscript.Append(
"    \"平顶山\", \"平顶山\",\n");
            sbJscript.Append(
"    \"濮阳\", \"濮阳\",\n");
            sbJscript.Append(
"    \"三门峡\", \"三门峡\",\n");
            sbJscript.Append(
"    \"商丘\", \"商丘\",\n");
            sbJscript.Append(
"    \"新乡\", \"新乡\",\n");
            sbJscript.Append(
"    \"信阳\", \"信阳\",\n");
            sbJscript.Append(
"    \"许昌\", \"许昌\",\n");
            sbJscript.Append(
"    \"周口\", \"周口\", \n");
            sbJscript.Append(
"    \"驻马店\", \"驻马店\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"香港\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"香港\", \"香港\", \n");
            sbJscript.Append(
"    \"九龙\", \"九龙\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"湖北\" : \n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"武汉(*)\", \"武汉\",\n");
            sbJscript.Append(
"    \"恩施\", \"恩施\",\n");
            sbJscript.Append(
"    \"鄂州\", \"鄂州\",\n");
            sbJscript.Append(
"    \"黄岗\", \"黄岗\",\n");
            sbJscript.Append(
"    \"黄石\", \"黄石\",\n");
            sbJscript.Append(
"    \"荆门\", \"荆门\",\n");
            sbJscript.Append(
"    \"荆州\", \"荆州\",\n");
            sbJscript.Append(
"    \"潜江\", \"潜江\",\n");
            sbJscript.Append(
"    \"十堰\", \"十堰\",\n");
            sbJscript.Append(
"    \"随州\", \"随州\",\n");
            sbJscript.Append(
"    \"武穴\", \"武穴\",\n");
            sbJscript.Append(
"    \"仙桃\", \"仙桃\",\n");
            sbJscript.Append(
"    \"咸宁\", \"咸宁\",\n");
            sbJscript.Append(
"    \"襄阳\", \"襄阳\",\n");
            sbJscript.Append(
"    \"襄樊\", \"襄樊\",\n");
            sbJscript.Append(
"    \"孝感\", \"孝感\",\n");
            sbJscript.Append(
"    \"宜昌\", \"宜昌\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"湖南\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"长沙(*)\", \"长沙\",\n");
            sbJscript.Append(
"    \"常德\", \"常德\",\n");
            sbJscript.Append(
"    \"郴州\", \"郴州\",\n");
            sbJscript.Append(
"    \"衡阳\", \"衡阳\",\n");
            sbJscript.Append(
"    \"怀化\", \"怀化\",\n");
            sbJscript.Append(
"    \"吉首\", \"吉首\",\n");
            sbJscript.Append(
"    \"娄底\", \"娄底\",\n");
            sbJscript.Append(
"    \"邵阳\", \"邵阳\",\n");
            sbJscript.Append(
"    \"湘潭\", \"湘潭\",\n");
            sbJscript.Append(
"    \"益阳\", \"益阳\",\n");
            sbJscript.Append(
"    \"岳阳\", \"岳阳\",\n");
            sbJscript.Append(
"    \"永州\", \"永州\",\n");
            sbJscript.Append(
"    \"张家界\", \"张家界\",\n");
            sbJscript.Append(
"    \"株洲\", \"株洲\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"江苏\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"南京(*)\", \"南京\",\n");
            sbJscript.Append(
"    \"常熟\", \"常熟\",\n");
            sbJscript.Append(
"    \"常州\", \"常州\",\n");
            sbJscript.Append(
"    \"海门\", \"海门\",\n");
            sbJscript.Append(
"    \"淮安\", \"淮安\",\n");
            sbJscript.Append(
"    \"江都\", \"江都\",\n");
            sbJscript.Append(
"    \"江阴\", \"江阴\",\n");
            sbJscript.Append(
"    \"昆山\", \"昆山\",\n");
            sbJscript.Append(
"    \"连云港\", \"连云港\",\n");
            sbJscript.Append(
"    \"南通\", \"南通\",\n");
            sbJscript.Append(
"    \"启东\", \"启东\",\n");
            sbJscript.Append(
"    \"沭阳\", \"沭阳\",\n");
            sbJscript.Append(
"    \"苏州\", \"苏州\",\n");
            sbJscript.Append(
"    \"太仓\", \"太仓\",\n");
            sbJscript.Append(
"    \"泰州\", \"泰州\",\n");
            sbJscript.Append(
"    \"同里\", \"同里\",\n");
            sbJscript.Append(
"    \"无锡\", \"无锡\",\n");
            sbJscript.Append(
"    \"徐州\", \"徐州\",\n");
            sbJscript.Append(
"    \"盐城\", \"盐城\",\n");
            sbJscript.Append(
"    \"扬州\", \"扬州\",\n");
            sbJscript.Append(
"    \"宜兴\", \"宜兴\",\n");
            sbJscript.Append(
"    \"仪征\", \"仪征\",\n");
            sbJscript.Append(
"    \"张家港\", \"张家港\", \n");
            sbJscript.Append(
"    \"镇江\", \"镇江\", \n");
            sbJscript.Append(
"    \"周庄\", \"周庄\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"江西\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array(\n");
            sbJscript.Append(
"    \"南昌(*)\", \"南昌\",\n");
            sbJscript.Append(
"    \"抚州\", \"抚州\",\n");
            sbJscript.Append(
"    \"赣州\", \"赣州\",\n");
            sbJscript.Append(
"    \"吉安\", \"吉安\",\n");
            sbJscript.Append(
"    \"景德镇\", \"景德镇\",\n");
            sbJscript.Append(
"    \"井冈山\", \"井冈山\",\n");
            sbJscript.Append(
"    \"九江\", \"九江\",\n");
            sbJscript.Append(
"    \"庐山\", \"庐山\",\n");
            sbJscript.Append(
"    \"萍乡\", \"萍乡\",\n");
            sbJscript.Append(
"    \"上饶\", \"上饶\",\n");
            sbJscript.Append(
"    \"新余\", \"新余\", \n");
            sbJscript.Append(
"    \"宜春\", \"宜春\", \n");
            sbJscript.Append(
"    \"鹰潭\", \"鹰潭\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"吉林\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"长春(*)\", \"长春\",\n");
            sbJscript.Append(
"    \"白城\", \"白城\",\n");
            sbJscript.Append(
"    \"白山\", \"白山\",\n");
            sbJscript.Append(
"    \"珲春\", \"珲春\",\n");
            sbJscript.Append(
"    \"辽源\", \"辽源\",\n");
            sbJscript.Append(
"    \"梅河\", \"梅河\",\n");
            sbJscript.Append(
"    \"吉林\", \"吉林\",\n");
            sbJscript.Append(
"    \"四平\", \"四平\",\n");
            sbJscript.Append(
"    \"松原\", \"松原\",\n");
            sbJscript.Append(
"    \"通化\", \"通化\",\n");
            sbJscript.Append(
"    \"延吉\", \"延吉\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"辽宁\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"沈阳(*)\", \"沈阳\",\n");
            sbJscript.Append(
"    \"鞍山\", \"鞍山\",\n");
            sbJscript.Append(
"    \"本溪\", \"本溪\",\n");
            sbJscript.Append(
"    \"朝阳\", \"朝阳\",\n");
            sbJscript.Append(
"    \"大连\", \"大连\",\n");
            sbJscript.Append(
"    \"丹东\", \"丹东\",\n");
            sbJscript.Append(
"    \"抚顺\", \"抚顺\",\n");
            sbJscript.Append(
"    \"阜新\", \"阜新\",\n");
            sbJscript.Append(
"    \"葫芦岛\", \"葫芦岛\",\n");
            sbJscript.Append(
"    \"锦州\", \"锦州\",\n");
            sbJscript.Append(
"    \"辽阳\", \"辽阳\",\n");
            sbJscript.Append(
"    \"盘锦\", \"盘锦\",\n");
            sbJscript.Append(
"    \"铁岭\", \"铁岭\",\n");
            sbJscript.Append(
"    \"营口\", \"营口\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"澳门\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"澳门\", \"澳门\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"内蒙古\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"呼和浩特(*)\", \"呼和浩特\",\n");
            sbJscript.Append(
"    \"阿拉善盟\", \"阿拉善盟\",\n");
            sbJscript.Append(
"    \"包头\", \"包头\",\n");
            sbJscript.Append(
"    \"赤峰\", \"赤峰\",\n");
            sbJscript.Append(
"    \"东胜\", \"东胜\",\n");
            sbJscript.Append(
"    \"海拉尔\", \"海拉尔\",\n");
            sbJscript.Append(
"    \"集宁\", \"集宁\",\n");
            sbJscript.Append(
"    \"临河\", \"临河\",\n");
            sbJscript.Append(
"    \"通辽\", \"通辽\",\n");
            sbJscript.Append(
"    \"乌海\", \"乌海\",\n");
            sbJscript.Append(
"    \"乌兰浩特\", \"乌兰浩特\", \n");
            sbJscript.Append(
"    \"锡林浩特\", \"锡林浩特\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"宁夏\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"银川(*)\", \"银川\",\n");
            sbJscript.Append(
"    \"固源\", \"固源\", \n");
            sbJscript.Append(
"\"石嘴山\", \"石嘴山\", \n");
            sbJscript.Append(
"    \"吴忠\", \"吴忠\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"青海\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array(\n");
            sbJscript.Append(
"    \"西宁(*)\", \"西宁\",\n");
            sbJscript.Append(
"    \"德令哈\", \"德令哈\",\n");
            sbJscript.Append(
"    \"格尔木\", \"格尔木\",\n");
            sbJscript.Append(
"    \"共和\", \"共和\",\n");
            sbJscript.Append(
"    \"海东\", \"海东\",\n");
            sbJscript.Append(
"    \"海晏\", \"海晏\",\n");
            sbJscript.Append(
"    \"玛沁\", \"玛沁\",\n");
            sbJscript.Append(
"    \"同仁\", \"同仁\", \n");
            sbJscript.Append(
"    \"玉树\", \"玉树\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"山东\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"济南(*)\", \"济南\",\n");
            sbJscript.Append(
"    \"滨州\", \"滨州\",\n");
            sbJscript.Append(
"    \"兖州\", \"兖州\",\n");
            sbJscript.Append(
"    \"德州\", \"德州\",\n");
            sbJscript.Append(
"    \"东营\", \"东营\",\n");
            sbJscript.Append(
"    \"荷泽\", \"荷泽\",\n");
            sbJscript.Append(
"    \"济宁\", \"济宁\",\n");
            sbJscript.Append(
"    \"莱芜\", \"莱芜\",\n");
            sbJscript.Append(
"    \"聊城\", \"聊城\",\n");
            sbJscript.Append(
"    \"临沂\", \"临沂\",\n");
            sbJscript.Append(
"    \"蓬莱\", \"蓬莱\",\n");
            sbJscript.Append(
"    \"青岛\", \"青岛\",\n");
            sbJscript.Append(
"    \"曲阜\", \"曲阜\",\n");
            sbJscript.Append(
"    \"日照\", \"日照\",\n");
            sbJscript.Append(
"    \"泰安\", \"泰安\",\n");
            sbJscript.Append(
"    \"潍坊\", \"潍坊\",\n");
            sbJscript.Append(
"    \"威海\", \"威海\",\n");
            sbJscript.Append(
"    \"烟台\", \"烟台\",\n");
            sbJscript.Append(
"    \"枣庄\", \"枣庄\",\n");
            sbJscript.Append(
"    \"淄博\", \"淄博\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"上海\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"上海\", \"上海\", \n");
            sbJscript.Append(
"    \"崇明\", \"崇明\", \n");
            sbJscript.Append(
"    \"朱家角\", \"朱家角\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"山西\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"太原(*)\", \"太原\",\n");
            sbJscript.Append(
"    \"长治\", \"长治\",\n");
            sbJscript.Append(
"    \"大同\", \"大同\",\n");
            sbJscript.Append(
"    \"候马\", \"候马\",\n");
            sbJscript.Append(
"    \"晋城\", \"晋城\",\n");
            sbJscript.Append(
"    \"离石\", \"离石\",\n");
            sbJscript.Append(
"    \"临汾\", \"临汾\",\n");
            sbJscript.Append(
"    \"宁武\", \"宁武\",\n");
            sbJscript.Append(
"    \"朔州\", \"朔州\",\n");
            sbJscript.Append(
"    \"忻州\", \"忻州\",\n");
            sbJscript.Append(
"    \"阳泉\", \"阳泉\", \n");
            sbJscript.Append(
"    \"榆次\", \"榆次\", \n");
            sbJscript.Append(
"    \"运城\", \"运城\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"陕西\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"西安(*)\", \"西安\",\n");
            sbJscript.Append(
"    \"安康\", \"安康\",\n");
            sbJscript.Append(
"    \"宝鸡\", \"宝鸡\",\n");
            sbJscript.Append(
"    \"汉中\", \"汉中\",\n");
            sbJscript.Append(
"    \"渭南\", \"渭南\",\n");
            sbJscript.Append(
"    \"商州\", \"商州\",\n");
            sbJscript.Append(
"    \"绥德\", \"绥德\",\n");
            sbJscript.Append(
"    \"铜川\", \"铜川\",\n");
            sbJscript.Append(
"    \"咸阳\", \"咸阳\",\n");
            sbJscript.Append(
"    \"延安\", \"延安\",\n");
            sbJscript.Append(
"    \"榆林\", \"榆林\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"四川\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"成都(*)\", \"成都\",\n");
            sbJscript.Append(
"    \"巴中\", \"巴中\",\n");
            sbJscript.Append(
"    \"达安\", \"达安\",\n");
            sbJscript.Append(
"    \"德阳\", \"德阳\",\n");
            sbJscript.Append(
"    \"都江堰\", \"都江堰\",\n");
            sbJscript.Append(
"    \"峨眉山\", \"峨眉山\",\n");
            sbJscript.Append(
"    \"涪陵\", \"涪陵\",\n");
            sbJscript.Append(
"    \"广安\", \"广安\",\n");
            sbJscript.Append(
"    \"广元\", \"广元\",\n");
            sbJscript.Append(
"    \"九寨沟\", \"九寨沟\",\n");
            sbJscript.Append(
"    \"康定\", \"康定\",\n");
            sbJscript.Append(
"    \"乐山\", \"乐山\",\n");
            sbJscript.Append(
"    \"泸州\", \"泸州\",\n");
            sbJscript.Append(
"    \"马尔康\", \"马尔康\",\n");
            sbJscript.Append(
"    \"绵阳\", \"绵阳\",\n");
            sbJscript.Append(
"    \"南充\", \"南充\",\n");
            sbJscript.Append(
"    \"内江\", \"内江\",\n");
            sbJscript.Append(
"    \"攀枝花\", \"攀枝花\",\n");
            sbJscript.Append(
"    \"遂宁\", \"遂宁\",\n");
            sbJscript.Append(
"    \"汶川\", \"汶川\",\n");
            sbJscript.Append(
"    \"西昌\", \"西昌\",\n");
            sbJscript.Append(
"    \"雅安\", \"雅安\",\n");
            sbJscript.Append(
"    \"宜宾\", \"宜宾\", \n");
            sbJscript.Append(
"    \"自贡\", \"自贡\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"台湾\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"台北(*)\", \"台北\",\n");
            sbJscript.Append(
"    \"基隆\", \"基隆\", \n");
            sbJscript.Append(
"    \"台南\", \"台南\", \n");
            sbJscript.Append(
"    \"台中\", \"台中\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"天津\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"天津\", \"天津\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"新疆\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"乌鲁木齐(*)\", \"乌鲁木齐\",\n");
            sbJscript.Append(
"    \"阿克苏\", \"阿克苏\",\n");
            sbJscript.Append(
"    \"阿勒泰\", \"阿勒泰\",\n");
            sbJscript.Append(
"    \"阿图什\", \"阿图什\",\n");
            sbJscript.Append(
"    \"博乐\", \"博乐\",\n");
            sbJscript.Append(
"    \"昌吉\", \"昌吉\",\n");
            sbJscript.Append(
"    \"东山\", \"东山\",\n");
            sbJscript.Append(
"    \"哈密\", \"哈密\",\n");
            sbJscript.Append(
"    \"和田\", \"和田\",\n");
            sbJscript.Append(
"    \"喀什\", \"喀什\",\n");
            sbJscript.Append(
"    \"克拉玛依\", \"克拉玛依\",\n");
            sbJscript.Append(
"    \"库车\", \"库车\",\n");
            sbJscript.Append(
"    \"库尔勒\", \"库尔勒\",\n");
            sbJscript.Append(
"    \"奎屯\", \"奎屯\",\n");
            sbJscript.Append(
"    \"石河子\", \"石河子\",\n");
            sbJscript.Append(
"    \"塔城\", \"塔城\",\n");
            sbJscript.Append(
"    \"吐鲁番\", \"吐鲁番\", \n");
            sbJscript.Append(
"    \"伊宁\", \"伊宁\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"西藏\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"拉萨(*)\", \"拉萨\",\n");
            sbJscript.Append(
"    \"阿里\", \"阿里\",\n");
            sbJscript.Append(
"    \"昌都\", \"昌都\",\n");
            sbJscript.Append(
"    \"林芝\", \"林芝\",\n");
            sbJscript.Append(
"    \"那曲\", \"那曲\", \n");
            sbJscript.Append(
"    \"日喀则\", \"日喀则\", \n");
            sbJscript.Append(
"    \"山南\", \"山南\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"云南\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"昆明(*)\", \"昆明\",\n");
            sbJscript.Append(
"    \"大理\", \"大理\",\n");
            sbJscript.Append(
"    \"保山\", \"保山\",\n");
            sbJscript.Append(
"    \"楚雄\", \"楚雄\",\n");
            sbJscript.Append(
"    \"大理\", \"大理\",\n");
            sbJscript.Append(
"    \"东川\", \"东川\",\n");
            sbJscript.Append(
"    \"个旧\", \"个旧\",\n");
            sbJscript.Append(
"    \"景洪\", \"景洪\",\n");
            sbJscript.Append(
"    \"开远\", \"开远\",\n");
            sbJscript.Append(
"    \"临沧\", \"临沧\",\n");
            sbJscript.Append(
"    \"丽江\", \"丽江\",\n");
            sbJscript.Append(
"    \"六库\", \"六库\",\n");
            sbJscript.Append(
"    \"潞西\", \"潞西\",\n");
            sbJscript.Append(
"    \"曲靖\", \"曲靖\",\n");
            sbJscript.Append(
"    \"思茅\", \"思茅\",\n");
            sbJscript.Append(
"    \"文山\", \"文山\",\n");
            sbJscript.Append(
"    \"西双版纳\", \"西双版纳\",\n");
            sbJscript.Append(
"    \"玉溪\", \"玉溪\", \n");
            sbJscript.Append(
"    \"中甸\", \"中甸\", \n");
            sbJscript.Append(
"    \"昭通\", \"昭通\");\n");
            sbJscript.Append(
"    break;\n");
            sbJscript.Append(
"case \"浙江\" :\n");
            sbJscript.Append(
"    var cityOptions = new Array( \n");
            sbJscript.Append(
"    \"杭州(*)\", \"杭州\",\n");
            sbJscript.Append(
"    \"安吉\", \"安吉\",\n");
            sbJscript.Append(
"    \"慈溪\", \"慈溪\",\n");
            sbJscript.Append(
"    \"定海\", \"定海\",\n");
            sbJscript.Append(
"    \"奉化\", \"奉化\",\n");
            sbJscript.Append(
"    \"海盐\", \"海盐\",\n");
            sbJscript.Append(
"    \"黄岩\", \"黄岩\",\n");
            sbJscript.Append(
"    \"湖州\", \"湖州\",\n");
            sbJscript.Append(
"    \"嘉兴\", \"嘉兴\",\n");
            sbJscript.Append(
"    \"金华\", \"金华\",\n");
            sbJscript.Append(
"    \"临安\", \"临安\",\n");
            sbJscript.Append(
"    \"临海\", \"临海\",\n");
            sbJscript.Append(
"    \"丽水\", \"丽水\",\n");
            sbJscript.Append(
"    \"宁波\", \"宁波\",\n");
            sbJscript.Append(
"    \"瓯海\", \"瓯海\",\n");
            sbJscript.Append(
"    \"平湖\", \"平湖\",\n");
            sbJscript.Append(
"    \"千岛湖\", \"千岛湖\",\n");
            sbJscript.Append(
"    \"衢州\", \"衢州\",\n");
            sbJscript.Append(
"    \"瑞安\", \"瑞安\",\n");
            sbJscript.Append(
"    \"绍兴\", \"绍兴\",\n");
            sbJscript.Append(
"    \"嵊州\", \"嵊州\",\n");
            sbJscript.Append(
"    \"台州\", \"台州\",\n");
            sbJscript.Append(
"    \"温岭\", \"温岭\",\n");
            sbJscript.Append(
"    \"温州\", \"温州\");\n");
            sbJscript.Append(
"    break;     \n");
            sbJscript.Append(
"}\n");
            sbJscript.Append(
"city.options.length = 0;\n");
            
if(type=="add")
            
{
                sbJscript.Append(
"city.options[0] = new Option(\"选择所在城市\",\"0\");\n");
            }

            
else
            
{
                sbJscript.Append(
"city.options[0] = new Option(\"所有城市\",\"0\");\n");
            }

            
            sbJscript.Append(
"if(cityOptions!=null){");
            sbJscript.Append(
"for(var i = 0; i < cityOptions.length/2; i++) {\n");
            sbJscript.Append(
"    city.options[i+1]=new Option(cityOptions[i*2],cityOptions[i*2+1]);\n");
            sbJscript.Append(
"    if (city.options[i].value==\"\")city.selectedIndex = i;}\n");
            sbJscript.Append(
"}}\n");

            
if(type=="add")
            
{
                sbJscript.Append(
"myForm."+client_city+".options[0] = new Option(\"选择所在城市\",\"0\");\n");
            }

            
else
            
{
                sbJscript.Append(
"myForm."+client_city+".options[0] = new Option(\"所有城市\",\"0\");\n");
            }

            sbJscript.Append(
"-->\n");
            sbJscript.Append(
"</SCRIPT>\n");
            lJscript.Text
=sbJscript.ToString();
        }

    }

posted on 2007-05-23 13:24  mbskys  阅读(419)  评论(0编辑  收藏  举报