关于option城市选择源码的信息
本文目录一览:
- 1、代码中选省,当是没有显示城市选择,是否代码有问题,有请说明
- 2、请问如何实现:在网页中选择了国家,下面自动出现该国家的省名供选择
- 3、从网上下载了个级联菜单选择城市的JS 发现获取到的是城市代码 怎么获取城市名?
- 4、jquery 下来框选中省份;弹出该省份的城市复选框 求全代码。jquery不是很懂
代码中选省,当是没有显示城市选择,是否代码有问题,有请说明
当然有!
阿城区距哈尔滨市中心区 23 公里 ,基本地貌为“六山一水三分田”,西部平原坦荡如砥,东部山区峰峦叠翠。幅员面积 2500 平方公里,辖 5 乡 9 镇、 5 个街道办事处、 108 个行政村,总人口 58 万,其中市区人口 22.7 万。阿城区是省内哈大齐工业走廊的哈尔滨内环区,是哈尔滨对俄贸易的重要交通枢纽和窗口,已逐步成为黑龙江省面向全国开放的一个重要窗口。
公元 1115 年,女真族首领完颜阿骨打建立大金帝国,定都今阿什河畔白城村,史称“金上京会宁府”,历经 4 帝 38 年。清宣统元年( 1909 年)设县,称阿勒楚喀城,简称阿城。 1987 年 2 月,经国务院批准撤县建市, 1996 年被评为黑龙江省历史文化名城。 2000 年、 2002 年和 2004 年,阿城市成功举办了三届中国·阿城金源文化节,扩大了阿城的影响,提高了阿城的知名度。 2006 年经国务院批准撤市建区,成为哈尔滨市的一个新区。
请问如何实现:在网页中选择了国家,下面自动出现该国家的省名供选择
script type="text/javascript"
//定义option城市选择源码了城市的二维数组option城市选择源码,里面的顺序跟省份的顺序是相同的。通过selectedIndex获得省份的下标值来得到相应的城市数组
var city=[
["北京","天津","上海","重庆","香港","澳门"],
["石家庄","唐山","秦皇岛","邯郸","邢台","保定","张家口","承德","沧州","廊坊","衡水"],
["太原","大同","阳泉","长治","晋城","朔州","晋中","运城","忻州","临汾","吕梁"],
["呼和浩特","包头","乌海","赤峰","通辽","鄂尔多斯","呼伦贝尔","巴彦淖尔","乌兰察布","兴安","锡林郭勒","阿拉善"],
["沈阳","大连","鞍山","抚顺","本溪","丹东","锦州","营口","阜新","辽阳","盘锦","铁岭","朝阳","葫芦岛"],
["长春","吉林","四平","辽源","通化","白山","松原","白城","延边"],
["哈尔滨","齐齐哈尔","鸡西","鹤岗","双鸭山","大庆","伊春","佳木斯","七台河","牡丹江","黑河","绥化","大兴安岭"],
["南京","苏州","扬州","无锡","徐州","常州","南通","连云港","淮安","盐城","镇江","泰州","宿迁"],
["杭州","宁波","温州","嘉兴","湖州","绍兴","金华","衢州","舟山","台州","丽水"],
["合肥","芜湖","蚌埠","淮南","马鞍山","淮北","铜陵","安庆","黄山","滁州","阜阳","宿州","巢湖","六安","亳州","池州","宣城"],
["福州","宁德","南平","厦门","莆田","三明","泉州","漳州"],
["南昌","上饶","萍乡","九江","景德镇","新余","鹰潭","赣州","吉安","宜春","抚州"],
["济南","青岛","淄博","枣庄","东营","烟台","潍坊","威海","济宁","泰安","日照","莱芜","临沂","德州","聊城","滨州","菏泽"],
["郑州","开封","洛阳","平顶山","焦作","鹤壁","新乡","安阳","濮阳","漯河","许昌","三门峡","南阳","商丘","信阳","周口","驻马店"],
["武汉","十堰","襄樊","鄂州","黄石","荆州","宜昌","荆门","孝感","黄冈","咸宁","随州","恩施"],
["长沙","株洲","湘潭","岳阳","邵阳","常德","衡阳","张家界","益阳","郴州","永州","怀化","娄底","湘西"],
["广州","清远","潮州","东莞","珠海","深圳","汕头","韶关","佛山","江门","湛江","茂名","肇庆","惠州","梅州","汕尾","阳江","河源","中山","揭阳","云浮"],
["南宁","柳州","桂林","梧州","北海","防城港","钦州","贵港","玉林","百色","贺州","河池","来宾","崇左"],
["海口","三亚"],
["成都","自贡","攀枝花","泸州","德阳","绵阳","广元","遂宁","内江","乐山","南充","宜宾","广安","达州","眉山","雅安","巴中","资阳","阿坝","甘孜","凉山"],
["贵阳","六盘水","遵义","安顺","铜仁","毕节","黔西南","黔东南","黔南"],
["昆明","曲靖","玉溪","保山","昭通","丽江","普洱","临沧","文山","红河","西双版纳","楚雄","大理","德宏","怒江","迪庆"],
["拉萨","昌都","山南","日喀则","那曲","阿里","林芝"],
["西安","铜川","宝鸡","咸阳","渭南","延安","汉中","榆林","安康","商洛"],
["兰州","白银","定西","敦煌","嘉峪关","金昌","天水","武威","张掖","平凉","酒泉","庆阳","临夏","陇南","甘南"],
["西宁","海东","海北","黄南","海南","果洛","玉树","海西"],
["银川","石嘴山","吴忠","固原","中卫"],
["乌鲁木齐","克拉玛依","吐鲁番","哈密","和田","阿克苏","喀什","克孜勒苏柯尔克孜","巴音郭楞蒙古","昌吉","博尔塔拉蒙古","伊犁哈萨克","阿勒泰"],
["台北","高雄","基隆","台中","台南","新竹","嘉义"]
];
function getCity(){
//获得省份下拉框的对象
var sltProvince=document.forms[0].province;
//获得城市下拉框的对象
var sltCity=document.forms[0].city;
//得到对应省份的城市数组
var provinceCity=city[sltProvince.selectedIndex - 1];
//清空城市下拉框option城市选择源码,仅留提示选项
sltCity.length=1;
//将城市数组中的值填充到城市下拉框中
for(var i=0;iprovinceCity.length;i++){
sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]);
}
}
/script
form action="#" method="POST" name="myform" target="_self" id="myform"
select name="province" onChange="getCity()"
option value="null" disabled="disabled"请选择所在省份/option
option value="直辖市"直辖市/option
option value="河北"河北/option
option value="山西"山西/option
option value="内蒙古"内蒙古/option
option value="辽宁"辽宁/option
option value="吉林"吉林/option
option value="黑龙江"黑龙江/option
option value="江苏"江苏/option
option value="浙江"浙江/option
option value="安徽"安徽 /option
option value="福建"福建 /option
option value="江西"江西/option
option value="山东"山东/option
option value="河南"河南/option
option value="湖北"湖北/option
option value="湖南"湖南/option
option value="广东"广东/option
option value="广西"广西/option
option value="海南"海南/option
option value="四川"四川/option
option value="贵州"贵州/option
option value="云南"云南/option
option value="西藏"西藏/option
option value="陕西"陕西 /option
option value="甘肃"甘肃 /option
option value="青海"青海/option
option value="宁夏"宁夏/option
option value="新疆"新疆/option
option value="台湾"台湾/option
/select
select name="city"
option selected="selected" value="null"请选择所在城市/option
/select
/form 直接用就可以option城市选择源码了。这是 省市 2级联动
从网上下载了个级联菜单选择城市的JS 发现获取到的是城市代码 怎么获取城市名?
a","b","c","d"];
arr[1]=["c++","oracle","sql","js"];数组下标为0option城市选择源码的有"a","b","c","d";
数组下标为1的有"c++","oracle","sql","js"option城市选择源码,
var i=document.form1.selterm.selectedIndex-1;这句话其实跟op=new Option(arr[i][j],arr[i][j]);有关,举个例子,选择1学期的时候,document.form1.selterm.selectedIndex为1,-1之后为0,然后找到arr[0],也就是["a","b","c","d"]),然后new出一个Option(arr[0][j],arr[0][j]);(一个option包含显示的内容和value值。)在清空之后,select下面是空的,必须加一个请选择的option填充,其实把下标修改一下,arr[1]=["a","b","c","d"];
arr[2]=["c++","oracle","sql","js"];这时候var i=document.form1.selterm.selectedIndex就可以option城市选择源码了,不需要减1option城市选择源码了,不知道option城市选择源码你是否明白意思了
另外,虚机团上产品团购,超级便宜
jquery 下来框选中省份;弹出该省份的城市复选框 求全代码。jquery不是很懂
百度 jquery 省市联动
一般都是带后台语言和数据库option城市选择源码的
单纯jquery写option城市选择源码的太长也不咋实用