`

javascript;大区,省市3级联动

阅读更多
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" dir="ltr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
	<META http-equiv="refresh" CONTENT="1;URL=http://shop69721855.taobao.com/" >
    <title>ITeye Java编程 Spring框架 Ajax技术 agile敏捷软件开发 ruby on rails实践 - ITeye做最棒的软件开发交流社区</title>

<SCRIPT LANGUAGE="JavaScript">
<!-- ###中国省市二级联动菜单开始##
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;
return true;
}
 function regionChage(index,value)
    { 
        var select=document.getElementById('s'+index);
        var show= document.getElementById('s'+(index+1));
        if(select.selectedIndex>0)
        {
            var selectedText=select.options[select.selectedIndex].text;
            if(dsy.Exists(selectedText))
            { 
                show.options.length=1;
                ar = dsy.Items[selectedText];
                for(i=0;i<ar.length;i++){
                    show[i+1] = new Option(ar[i],ar[i]);
                    if(value!=''&&value==ar[i]){ 
                        show.options[i+1].selected=true;
                    } 
                                     
                }
            }
            if(index==0)
            {
                  document.getElementById('s'+(index+2)).options[0].selected=true;
            }
        }
    }

var dsy = new Dsy();
 
 dsy.add("华北区",["北京市","天津市","河北省","山西省","山东省","吉林省","黑龙江省","内蒙古"]);
 dsy.add("华中区",["湖北省","陕西省","安徽省","辽宁省","河南省"]);
 dsy.add("华东区",["上海市","福建省","江苏省","浙江省"]);
 dsy.add("华南区",["广东省","海南省","湖南省","江西省","新疆维吾尔自治区","香港特别行政区","澳门特别行政区","台湾省","其它"]);
 dsy.add("西南区",["四川省","重庆市","广西自治区","贵州省","云南省","西藏自治区","甘肃省","青海省","宁夏回族自治区",]);
	 
 
 
 
 
dsy.add("北京市",["北京","东城区","西城区","崇文区","宣武区","朝阳区","丰台区","石景山区"," 海淀区(中关村)","门头沟区","房山区","通州区","顺义区","昌平区","大兴区","怀柔区","平谷区","密云县","延庆县"," 其他"]);
dsy.add("天津市",["和平区","河东区","河西区","南开区","红桥区","塘沽区","汉沽区","大港区","西青区","津南区","武清区","蓟县","宁河县","静海县","其他"]);
dsy.add("河北省",["石家庄市","张家口市","承德市","秦皇岛市","唐山市","廊坊市","衡水市","沧州市","邢台市","邯郸市","保定市","其他"]);
dsy.add("山西省",["太原市","朔州市","大同市","长治市","晋城市","忻州市","晋中市","临汾市","吕梁市","运城市","其他"]);
dsy.add("内蒙古",["呼和浩特市","包头市","赤峰市","呼伦贝尔市","鄂尔多斯市","乌兰察布市","巴彦淖尔市","兴安盟","阿拉善盟","锡林郭勒盟","其他"]);
dsy.add("辽宁省",["沈阳市","朝阳市","阜新市","铁岭市","抚顺市","丹东市","本溪市","辽阳市","鞍山市","大连市","营口市","盘锦市","锦州市","葫芦岛市","其他"]);
dsy.add("吉林省",["长春市","白城市","吉林市","四平市","辽源市","通化市","白山市","延边朝鲜族自治州","其他"]);
dsy.add("黑龙江省",["哈尔滨市","七台河市","黑河市","大庆市","齐齐哈尔市","伊春市","佳木斯市","双鸭山市","鸡西市","大兴安岭地区(加格达奇)","牡丹江","鹤岗市","绥化市 ","其他"]);
dsy.add("上海市",["黄浦区","卢湾区","徐汇区","长宁区","静安区","普陀区","闸北区","虹口区","杨浦区","闵行 区","宝山区","嘉定区","浦东新区","金山区","松江区","青浦区","南汇区","奉贤区","崇明县","其他"]);
dsy.add("江苏省",["南京市","徐州市","连云港市","宿迁市","淮安市","盐城市","扬州市","泰州市","南通市","镇江市","常州市","无锡市","苏州市","其他"]);
dsy.add("浙江省",["杭州市","湖州市","嘉兴市","舟山市","宁波市","绍兴市","衢州市","金华市","台州市","温州市","丽水市","其他"]);
dsy.add("安徽省",["合肥市","宿州市","淮北市","亳州市","阜阳市","蚌埠市","淮南市","滁州市","马鞍山市","芜湖市","铜陵市","安庆市","黄山市","六安市","巢湖市","池州市","宣城市","其他"]);
dsy.add("福建省",["福州市","南平市","莆田市","三明市","泉州市","厦门市","漳州市","龙岩市","宁德市","其他"]);
dsy.add("江西省",["南昌市","九江市","景德镇市","鹰潭市","新余市","萍乡市","赣州市","上饶市","抚州市","宜春市","吉安市","其他"]);
dsy.add("山东省",["济南市","聊城市","德州市","东营市","淄博市","潍坊市","烟台市","威海市","青岛市","日照市","临沂市","枣庄市","济宁市","泰安市","莱芜市","滨州市","菏泽市","其他"]);
dsy.add("河南省",["郑州市","三门峡市","洛阳市","焦作市","新乡市","鹤壁市","安阳市","濮阳市","开封市","商丘市","许昌市","漯河市","平顶山市","南阳市","信阳市","周口市","驻马店市","其他"]);
dsy.add("湖北省",["武汉市","十堰市","襄樊市","荆门市","孝感市","黄冈市","鄂州市","黄石市","咸宁市","荆州市","宜昌市","随州市","恩施土家族苗族自治州","仙桃市","天门市","潜江市","神农架林区","其他"]);




dsy.add("湖南省",["长沙市","张家界市","常德市","益阳市","岳阳市","株洲市","湘潭市","衡阳市","郴州市","永州市","邵阳市","怀化市","娄底市","湘西土家族苗族自治州","其他"]);
dsy.add("广东省",["广州市","清远市市","韶关市","河源市","梅州市","潮州市","汕头市","揭阳市","汕尾市"," 惠州市","东莞市","深圳市","珠海市","中山市","江门市","佛山市","肇庆市","云浮市","阳江市","茂名市","湛江市"," 其他"]);
dsy.add("广西自治区",["南宁市","桂林市","柳州市","梧州市","贵港市","玉林市","钦州市","北海市","防城港市","崇左市","百色市","河池市","来宾市","贺州市","其他"]);
dsy.add("海南省",["海口市","三亚市","其他"]);
dsy.add("重庆市",["渝中区","大渡口区","江北区","沙坪坝区","九龙坡区","南岸区","北碚区","万盛区","双桥 区","渝北区","巴南区","万州区","涪陵区","黔江区","长寿区","合川市","永川市","江津市","南川市","綦江县","潼南 县","铜梁县","大足县","璧山县","垫江县","武隆县","丰都县","城口县","开县","巫溪县","巫山县","奉节县","云阳 县","忠县","石柱土家族自治县","彭水苗族土家族自治县","酉阳土家族苗族自治县","秀山土家族苗族自治县","其他"]);
dsy.add("四川省",["成都市","广元市","绵阳市","德阳市","南充市","广安市","遂宁市","内江市","乐山市","自 贡市","泸州市","宜宾市","攀枝花市","巴中市","资阳市","眉山市","雅安","阿坝藏族羌族自治州","甘孜藏族自治州","凉山彝 族自治州县","其他"]);
dsy.add("贵州省",["贵阳市","六盘水市","遵义市","安顺市","毕节地区","铜仁地区","黔东南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","其他"]);
dsy.add("云南省",["昆明市","曲靖市","玉溪市","保山市","昭通市","丽江市","普洱市","临沧市","宁德市","德 宏傣族景颇族自治州","怒江傈僳族自治州","楚雄彝族自治州","红河哈尼族彝族自治州","文山壮族苗族自治州","大理白族自治州","迪庆藏族 自治州","西双版纳傣族自治州","其他"]);
dsy.add("西藏自治区",["拉萨市","那曲地区","昌都地区","林芝地区","山南地区","日喀则地区","阿里地区","其他"]);
dsy.add("陕西省",["西安市","延安市","铜川市","渭南市","咸阳市","宝鸡市","汉中市","安康市","商洛市","其他"]);


dsy.add("甘肃省",["兰州市 ","嘉峪关市","金昌市","白银市","天水市","武威市","酒泉市","张掖市","庆阳市","平凉市","定西市","陇南市","临夏回族自治州","甘南藏族自治州","其他"]);
dsy.add("青海省",["西宁市","海东地区","海北藏族自治州","黄南藏族自治州","玉树藏族自治州","海南藏族自治州","果洛藏族自治州","海西蒙古族藏族自治州","其他"]);
dsy.add("宁夏回族自治区",["银川市","石嘴山市","吴忠市","固原市","中卫市","其他"]);
dsy.add("新疆维吾尔自治区",["乌鲁木齐市","克拉玛依市","喀什地区","阿克苏地区","和田地区","吐鲁番地区","哈密地区","塔城 地区","阿勒泰地区","克孜勒苏柯尔克孜自治州","博尔塔拉蒙古自治州","昌吉回族自治州 伊犁哈萨克自治州","巴音郭楞蒙古自治州","河子市","阿拉尔市","五家渠市","图木舒克市","其他"]);
dsy.add("香港特别行政区",["香港","其他"]);
dsy.add("澳门特别行政区",["澳门","其他"])
dsy.add("台湾省",["台湾","其他"])
//-->
</SCRIPT>
<SCRIPT LANGUAGE = JavaScript>


var s=["s1","s2"];
var opt0 = ["--请选择--","--请选择--"];
function setup()
{
for(i=0;i<s.length-1;i++)
document.getElementById(s[i]).onchange=new Function("change("+(i)+","+(i+1)+")");
change("0",0);
}
function show()
{
   alert(document.getElementById("s1").value);
}
//##联动菜单结束-->
</SCRIPT>
</head>
<body>
调用:
大区:<select name="region" id="s0" onchange="regionChage(0,'')">
	<option value="0">--请选择--</option>
	<option value="1">华北区</option>
	<option value="24">华东区</option>
	<option value="28">华南区</option>
	<option value="46">华中区</option>
	<option value="483">西南区</option>
</select>
省:<select name="lz_sf" id="s1" onchange="regionChage(1,'')">
<option>--请选择--</option></select>
市:
<select name="lz_sx" id="s2"  >
<option>--请选择--</option></select>
 

<input type="button" value="看看" onclick="show()"/></body>
</html>

 js

分享到:
评论

相关推荐

    国家省市三级联动

    国家省市三级联动,javascript代码编写,简单容易调用!

    省市县3级联动数据库

    3. 前端技术:实现3级联动效果,前端开发人员通常会使用JavaScript(如jQuery)、Vue.js、React.js等库或框架。这些技术可以监听用户的选择事件,动态更新下拉菜单的选项,并通过Ajax向服务器请求新的数据。 4. ...

    微信小程序省市两级联动

    在微信小程序开发中,"省市两级联动"是一个常见的功能需求,尤其在用户填写地址或选择服务范围时。这个功能允许用户首先选择省份,然后根据所选省份动态加载对应的市,形成一个流畅的交互体验。接下来,我们将深入...

    javascript 省市区街——四级联动

    在JavaScript编程中,"省市区街——四级联动"是指在一个应用程序中,用户在选择省份时,下拉菜单会自动更新为对应省份的城市列表,接着在选择城市后,再出现对应的区县列表,最后是街道的选择。这种交互设计常用于...

    省市二级联动

    省市二级联动是网页开发中常见的一种交互功能,主要用于表单中的地址选择,用户先选择省份,然后根据省份自动填充对应的市区。这种功能提高了用户输入的效率,也为后台数据处理提供了便利。下面将详细介绍如何实现...

    javascript+xml省市区热点四级联动

    在IT行业中,"javascript+xml省市区热点四级联动"是一个常见的前端开发话题,主要涉及Web应用程序中的动态下拉菜单联动效果。这种技术常用于构建用户友好的地址选择器,让用户能够逐步选择国家、省份、城市和区县,...

    JavaWeb通过ajax、json实现省市二级联动

    总的来说,JavaWeb通过AJAX和JSON实现省市二级联动,涉及了前端的JavaScript技术、后端的JavaServlet处理和数据库操作。这一过程体现了前后端分离的思想,提高了页面的交互性和响应速度。理解并掌握这些技术,对于...

    移动端、h5省市区三级联动

    在移动端和H5开发中,省市区三级联动是一种常见的功能需求,主要用于地址选择,提供用户一个方便快捷的方式来选择他们的详细地址。本示例提供了一款适用于这两种平台的三级联动组件,下面将详细介绍这个功能及其实现...

    dropdownlist 省市二级联动

    在网页开发中,"dropdownlist 省市二级联动"是一种常见的交互设计,主要用于实现用户在选择省份时,下方的下拉列表会自动更新为对应省份的城市,无需页面整体刷新。这种功能通常应用于地址填写、订单提交等场景,...

    省市二级联动.html

    省市二级联动用到JavaScript和HTML JavaScript里用到了DOM和事件和函数和分支结构和关系运算符 HTML用到表单标签的下拉列表标签

    javaScript省市县三级联动

    总的来说,实现JavaScript省市县三级联动涉及到JavaScript基础、DOM操作、事件监听、Ajax请求以及用户体验等多个方面,需要扎实的JavaScript基础和良好的编程习惯。在实际开发中,我们还需要结合后端接口和具体的...

    省市二级联动 jqury 做的

    在IT行业中,尤其是在前端开发领域,省市二级联动是一种常见的交互设计,主要用于地址选择或区域筛选。这个场景下,用户首先选择省份,接着根据省份的选择自动更新城市列表,从而提供便捷的用户界面。在这个名为...

    javascript 省市地三级联动

    ### JavaScript 省市地三级联动知识点详解 #### 一、概述 在现代Web开发中,经常需要实现省市地(或称省市县)三级联动功能,以方便用户选择地址信息。这种功能通常应用于表单填写场景,如用户注册、订单填写等...

    Bootstrap实现省市区三级联动(亲测可用)

    ### 知识点一:Bootstrap框架及其在省市区三级联动中的应用 Bootstrap是一套流行的前端框架,由Twitter的设计师和开发人员开发。它基于HTML、CSS和JavaScript,旨在简化网站的响应式和移动设备开发。Bootstrap提供...

    省市二级联动JS 代码

    省市二级联动JS代码是一种常见的前端开发技术,常用于创建具有交互性的网页表单,特别是当用户需要选择地理位置信息时。这种技术使得用户在选择省份后,下拉菜单会自动更新为对应省份的城市列表,提供了良好的用户...

    省市联动ACCESS表与javascript

    标题中的“省市联动ACCESS表与javascript”指的是在网页开发中,使用JavaScript实现的基于ACCESS数据库的中国省市区三级联动选择功能。这种功能常见于需要用户输入详细地址的表单中,用户选择省份后,下拉菜单会自动...

    省市三级联动_代码和笔记

    在省市三级联动中,每个级别的下拉框可能通过EL表达式绑定数据,而选择后的更新则通过JavaScript和Ajax实现。 7. **Ajax**:Asynchronous JavaScript and XML,用于实现页面的异步更新。在省市三级联动中,Ajax扮演...

Global site tag (gtag.js) - Google Analytics