`

地域(js)

阅读更多
  • js代码
<script type="text/javascript">
  var areaList={ 
		"北京":[["选择城区","10"],["东城区",""],["西城区",""],["崇文区",""],["宣武区",""],["朝阳区",""],["丰台区",""],["石景山区",""],["海淀区",""],["门头沟区",""],["房山区",""],["通州区",""],["顺义区",""],["延庆县",""],["昌平县",""],["怀柔县",""],["密云县",""],["平谷县",""],["大兴县",""]], 
		"天津":[["选择城区","22"],["和平区",""],["河东区",""],["河西区",""],["南开区",""],["河北区",""],["红桥区",""],["塘沽区",""],["大港区",""],["汉沽区",""],["东丽区",""],["西青区",""],["津南区",""],["北辰区",""],["蓟县","22"],["宝坻县",""],["武清县",""],["宁河县",""],["静海县",""]], 
		"上海":[["选择城区","21"],["南市区",""],["卢湾区",""],["徐汇区",""],["长宁区",""],["静安区",""],["普陀区",""],["闸北区",""],["虹口区",""],["杨浦区",""],["闵行区",""],["宝山区",""],["嘉定区",""],["浦东新区",""],["金山区",""],["松江区",""],["崇明县",""],["青浦县",""],["南汇县",""],["奉贤县",""],["黄浦区",""]], 
		"重庆":[["选择城区","23"],["重庆市",""],["城口县",""],["大足县",""],["垫江县",""],["丰都县",""],["奉节县",""],["河川市",""],["江津市",""],["开县","23"],["梁平县",""],["南川市",""],["彭水苗族土家族自治县",""],["荣昌县",""],["石柱土家族自治县",""],["铜梁县",""],["巫山县",""],["巫溪县",""],["武隆县",""],["秀山土家苗族自治区",""],["永川市",""],["酉阳土家苗族自治区",""],["云阳县",""],["忠县","23"],["潼南县",""],["碧山县",""],["綦江县",""]], 
		"香港":[["选择城区","0852"],["香港",""],["九龙",""],["新界",""],["大屿",""]], 
		"澳门":[["选择城区","0853"],["澳门",""]], 
		"西藏":[["阿里","8073"],["昌都","895"],["拉萨","891"],["林芝","894"],["那曲","896"],["日喀则","892"],["山南","893"]], 
		"新疆":[["阿克苏","997"],["阿拉尔","997"],["巴音郭楞蒙古自治州",""],["博尔塔拉蒙古自治州",""],["昌吉回族自治州",""],["哈密","902"],["和田","903"],["喀什",""],["克拉玛依","990"],["克孜勒苏柯尔克孜自治州",""],["石河子","993"],["图木舒克",""],["吐鲁番","995"],["乌鲁木齐","991"],["奎屯","992"],["五家渠",""],["伊犁哈萨克自治州",""]], 
		"内蒙古":[["阿拉善盟",""],["巴彦淖尔盟",""],["包头","472"],["赤峰","476"],["呼和浩特","471"],["呼伦贝尔",""],["通辽","475"],["乌海","473"],["乌兰察布盟",""],["锡林郭勒盟",""],["兴安盟",""],["鄂尔多斯",""]], 
		"广西":[["百色","776"],["北海","779"],["崇左","771"],["防城港","770"],["桂林","773"],["贵港","775"],["河池","778"],["贺州",""],["来宾","772"],["柳州","772"],["南宁","771"],["钦州","777"],["梧州","774"],["玉林","775"]], 
		"宁夏":[["固原","954"],["石嘴山","952"],["吴忠","953"],["银川","951"]], 
		"山西":[["长治","355"],["大同","352"],["晋城","356"],["晋中",""],["临汾","357"],["吕梁",""],["朔州","349"],["太原","351"],["忻州","350"],["阳泉","353"],["运城","359"]], 
		"河南":[["安阳","372"],["鹤壁","392"],["济源","391"],["焦作","391"],["洛阳","379"],["南阳","377"],["开封","378"],["平顶山","375"],["三门峡","398"],["商丘","370"],["信阳","376"],["新乡","373"],["许昌","374"],["郑州","371"],["周口","394"],["驻马店","396"],["漯河","395"],["濮阳","393"]], 
		"河北":[["保定","312"],["沧州","317"],["邯郸","310"],["承德","314"],["衡水","318"],["秦皇岛","335"],["廊坊","316"],["石家庄","311"],["唐山","315"],["邢台","319"],["张家口","313"]], 
		"江西":[["抚州","794"],["赣江",""],["吉安","796"],["景德镇","798"],["九江","792"],["南昌","791"],["上饶","793"],["萍乡","799"],["新余","790"],["宜春","795"],["鹰潭","701"]], 
		"湖南":[["常德",""],["长沙",""],["郴州",""],["衡阳",""],["怀化",""],["娄底",""],["邵阳",""],["湘潭",""],["湘西土家族苗族自治州",""],["益阳",""],["永州",""],["岳阳",""],["张家界",""],["株洲",""]], 
		"江苏":[["常州","519"],["连云港","518"],["淮安","517"],["南京","25"],["南通","513"],["苏州","512"],["宿迁","527"],["泰州","523"],["无锡","510"],["徐州","516"],["盐城","515"],["扬州","514"],["镇江","511"]], 
		"浙江":[["杭州","571"],["湖州","572"],["嘉兴","573"],["金华","579"],["丽水","578"],["宁波","574"],["绍兴","575"],["台州","576"],["温州","577"],["舟山","580"],["衢州","570"]], 
		"安徽":[["安庆","556"],["蚌埠","552"],["巢湖","565"],["池州",""],["滁州","550"],["阜阳","558"],["合肥","551"],["淮北","561"],["淮南","554"],["黄山","559"],["六安","564"],["马鞍山","555"],["宿州","557"],["铜陵","562"],["芜湖","553"],["宣城",""],["亳州","558"]], 
		"湖北":[["鄂州","711"],["恩施土家族苗族自治州",""],["黄冈","713"],["黄石","714"],["荆门","727"],["荆州",""],["神农架林区",""],["潜江","728"],["十堰","719"],["随州","722"],["天门","728"],["武汉","27"],["咸宁","715"],["仙桃",""],["襄樊","710"],["孝感","712"],["宜昌","717"]], 
		"黑龙江":[["大庆","459"],["大兴安岭",""],["哈尔滨","451"],["鹤岗","454"],["黑河","456"],["鸡西","453"],["佳木斯","454"],["牡丹江","453"],["七台河","453"],["齐齐哈尔","452"],["双鸭山","454"],["绥化 ",""],["伊春","458"]], 
		"吉林":[["白城","436"],["白山",""],["长春","431"],["吉林","431"],["辽源","437"],["四平","434"],["松原","438"],["通化","435"],["延边朝鲜族自治州",""]], 
		"辽宁":[["鞍山","555"],["本溪","414"],["朝阳","421"],["大连","456"],["丹东","415"],["抚顺","413"],["阜新","418"],["葫芦岛","429"],["锦州","416"],["辽阳","419"],["盘锦","427"],["沈阳","24"],["铁岭","410"],["营口","417"]], 
		"陕西":[["安康","915"],["宝鸡","917"],["汉中","916"],["商洛",""],["铜川","919"],["西安","29"],["渭南","913"],["咸阳","910"],["延安","911"],["榆林","912"]], 
		"甘肃":[["白银","943"],["定西","932"],["甘南藏族自治区",""],["嘉峪关","937"],["金昌","935"],["酒泉","937"],["兰州","931"],["临夏回族自治区",""],["陇南",""],["平凉","943"],["庆阳","9441"],["天水","938"],["武威",""],["张掖","936"]], 
		"青海":[["果洛藏族自治州",""],["海北藏族自治州",""],["海东",""],["海南藏族自治州",""],["海西蒙古族藏族自治州",""],["黄南藏族自治州",""],["西宁","971"],["玉树藏族自治州",""]], 
		"云南":[["保山","875"],["楚雄彝族自治州",""],["大理白族自治州",""],["德宏傣族景颇族自治州",""],["迪庆藏族自治州",""],["红河哈尼族彝族自治州",""],["昆明","871"],["丽江","888"],["临沧","883"],["怒江傈僳族自治州",""],["曲靖","874"],["思茅","879"],["文山壮族苗族自治州",""],["西双版纳傣族自治州",""],["玉溪","877"],["昭通","870"]], 
		"贵州":[["安顺","853"],["毕节","857"],["贵阳","851"],["六盘水","858"],["黔东南苗族侗族自治州",""],["黔南布依族苗族自治州",""],["铜仁","856"],["遵义","852"],["黔西南布依族苗族自治州",""]], 
		"四川":[["阿坝藏族羌族自治州",""],["巴中","8279"],["德阳","838"],["成都","28"],["达州",""],["甘孜藏族自治州",""],["广安","826"],["广元","839"],["乐山","833"],["凉山彝族自治州",""],["眉山","833"],["绵阳","816"],["南充","817"],["内江","832"],["攀枝花","812"],["遂宁","825"],["雅安","835"],["宜宾","831"],["资阳","832"],["自贡","813"],["泸州","830"]], 
		"福建":[["福州","591"],["龙岩","597"],["南平","599"],["宁德","593"],["莆田","594"],["泉州","595"],["三明","598"],["漳州","596"],["厦门","592"]], 
		"山东":[["滨州","543"],["德州","534"],["东营","546"],["荷泽","530"],["济南","531"],["济宁","537"],["莱芜","634"],["聊城","635"],["临沂","539"],["青岛","532"],["日照","633"],["泰安","538"],["威海","631"],["潍坊","536"],["烟台","535"],["枣庄","632"],["淄博","533"]], 
		"广东":[["潮州","768"],["东莞","769"],["佛山","757"],["广州","20"],["河源","762"],["江门","750"],["揭阳","663"],["惠州","752"],["茂名","668"],["梅州","753"],["清远","763"],["汕头","754"],["汕尾","660"],["韶关","751"],["深圳","755"],["阳江","662"],["云浮","766"],["湛江","759"],["肇庆","758"],["中山","760"],["珠海","756"]], 
		"海南":[["白沙黎族自治县",""],["保亭黎族苗族自治县",""],["昌江黎族自治县",""],["澄迈县",""],["定安县",""],["海口","898"],["东方","890"],["乐东黎族自治县",""],["临高县",""],["陵水黎族自治县",""],["琼海","898"],["琼中黎族苗族自治县",""],["三亚","899"],["屯昌县",""],["万宁","898"],["文昌","898"],["五指山",""],["儋州","890"]], 
		"台湾":[["台北市",""],["高雄市",""],["台南市",""],["台中市",""],["基隆",""],["新竹",""]], 
		"海外华人":[["北美华人",""],["南美华人",""],["澳洲华人",""],["亚洲华人",""],["欧洲华人",""],["非洲华人",""]], 
		"各国外宾":[["北美外宾",""],["南美外宾",""],["澳洲外宾",""],["亚洲外宾",""],["欧洲外宾",""],["非洲外宾",""]]
		}; 
		var i=0;
		for(name in areaList){
			var op = new Option(name,name);
			document.getElementById("p1").options[i]=op;
			if(i==0){
				var arr=areaList[name];
				for(var j=0;j<arr.length;j++){
					var op1 = new Option(arr[j][0],arr[j][0]);
				    document.getElementById("p2").options[j]=op1;
			    }
			}
			i++;
		}
		function chg(_val) {
			var arr=areaList[_val];
				for(var j=0;j<arr.length;j++){
					var op1 = new Option(arr[j][0],arr[j][0]);
				    document.getElementById("p2").options[j]=op1;
			    }
		}
</script>

  

  •  jsp页面(选择域)
<select name="addr1" onchange="chg(this.value)" id="p1"></select>
<select name="addr2"  id="p2"></select>

 

分享到:
评论

相关推荐

    地域城市选择特效js代码

    关于多层地域城市的js代码,直接稍作修改就可以使用

    省市区县js文件.zip

    包含全国地图js文件,包含到区县级,可用于echarts绘制地图图表,里面包含各地图的编码文件,可以快速找到自己所需要的地图文件

    js+xml地域选择

    “js+xml地域选择”功能,主要是利用JavaScript的动态特性与XML的数据存储能力相结合,实现一个动态的、逐级展开的地域选择器。用户首先选择省份,接着城市会根据所选省份自动加载,然后可以选择具体的县区,这一...

    通过身份证号,取得发证地域的Javascript实现

    通过身份证号,取得发证地域的Javascript实现

    js实现二级地域选择

    "js实现二级地域选择"这个主题,就是针对这种需求的一种解决方案。它旨在通过JavaScript实现一个交互式的省份和城市选择功能,让用户能够方便地从预设的省级和市级列表中进行选择,而无需开发者手动编写复杂的逻辑。...

    地域代码省市区,城市选择,工具函数js.rar

    "地域代码省市区,城市选择,工具函数js.rar"这个压缩包文件提供了一套JavaScript解决方案来处理这些需求。 首先,我们要理解什么是地域代码。地域代码通常指的是国家、省份、城市等行政区域的编码,用于标准化地...

    js实现二级地域选择.zip

    在"js实现二级地域选择.zip"这个压缩包中,我们可以推测这是一个使用JavaScript编写的二级地区选择功能,常用于网站的地址输入或者配送范围选择等场景。这个功能允许用户首先选择一级地区(如省份),然后根据一级...

    小程序引用地域文件area.js

    在小程序中,编写区域选择是地域(省、市、区)的选择相关文件,尤其在小程序中添加收货地址或者填写个人信息的时候会涉及到的文件,希望可以帮助到大家。

    地域 选择插件

    这时,一种方便用户操作的“地域选择插件”就显得尤为重要。"jQuery 地域选择器"是一种专门针对这种情况设计的插件,它能够帮助用户在网页上轻松、快速地选择他们所在的地区。 jQuery是一个广泛使用的JavaScript库...

    js javaScript 验证校验小工具包

    这个"js javaScript 验证校验小工具包"显然是一个集合了各种JavaScript验证和校验功能的资源库,旨在帮助开发者更方便地处理表单验证、数据格式检查等常见任务。 在前端开发中,验证和校验通常涉及以下几个方面: ...

    js根据ip跳转到相应的城市的代码

    标题中的“js根据ip跳转到相应的城市代码”是指一种JavaScript技术,用于识别访问网站的用户所在的地理位置,并根据其IP地址自动将用户重定向到对应城市的特定页面。这种功能在提供本地化服务或内容定制的网站中十分...

    iosSelect.js 五级联动(最多支持六级联动)

    iosSelect.js 是一个轻量级的JavaScript插件,其核心目标是模拟iOS设备上的选择器样式,提供一种优雅的五级联动选择体验。它通常与CSS样式文件(如iosSelect.css)一起使用,以确保视觉效果与iOS设备的原生风格保持...

    某地域风情公司FLASH网页模板

    这种模板通常包括HTML、CSS和JavaScript代码,以及图像和其他媒体资源。 3. **创意设计**:创意网页设计强调独特性和个性化,通过视觉效果和交互设计吸引用户,提升品牌形象。 4. **网页特效**:网页特效是通过...

    JS获取ip地址归属地

    &lt;script src="js/jquery.js" type="text/javascript"&gt; ``` 然后,我们可以使用 jQuery 的 Ajax 方法来调用第三方 API 获取用户的 IP 地址归属地: ``` &lt;script type="text/javascript"&gt; $(document).ready(function...

    china.js_china.js_js中国地图_

    《china.js:绘制中国地图的JavaScript库》 在数字化时代,数据可视化已经成为信息传播的重要手段,其中地图作为地理信息的直观展示方式,被广泛应用在各种Web应用中。"china.js"是一个专门用于在网页上绘制中国...

    基于bootstrap做的地域选择下拉框.zip

    为了使用这个"基于bootstrap做的地域选择下拉框",开发者需要了解基本的HTML、CSS和JavaScript知识,特别是Bootstrap框架的基本使用。他们可以将提供的文件(可能是一个HTML示例文件和必要的CSS/JS文件)引入到自己...

    china.js_china.js下载_china.js_

    通过加载China.js,Echarts可以绘制出精确且完整的中国地图,方便进行地域相关的数据分析和展示。 在Echarts的早期版本中,China.js通常可以从官方网站直接下载。然而,随着Echarts的更新迭代,官方下载目录已经...

    moment.js luxon.js

    `moment.js` 和 `luxon.js` 是两个广泛使用的JavaScript库,专门用于处理日期和时间,它们都提供了丰富的功能和强大的API来满足各种复杂的日期时间需求。`i18n`(国际化)是这两个库的一个重要特性,使得它们能够...

    一个JS代码一个JS代码

    JavaScript,简称JS,是Web开发中的重要脚本语言,用于实现客户端的动态效果和交互。在网页中,JS代码通常嵌入在HTML中或者通过外部链接的.js文件引入。"一个JS代码一个JS代码"这个标题暗示我们将探讨的是关于...

    js代码-浏览器获取用户地区功能

    在JavaScript编程中,获取用户地区信息是一项常见的需求,特别是在实现个性化体验、本地化服务或地理定位相关功能时。本文将详细讲解如何通过JS代码在浏览器环境中获取用户的地区信息。 首先,浏览器提供了`...

Global site tag (gtag.js) - Google Analytics