• 三级联动省市区


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript">
    var cityList = new Array();
    var quList = new Array();
    cityList['北京'] = [ '北京' ];
    cityList['浙江'] = [ '杭州市', '温州市', '金华市', '临安市' ];
    cityList['陕西'] = [ '西安', '宝鸡', '咸阳' ];
    cityList['甘肃'] = [ '兰州市', '武威市', '酒泉市', '张掖市' ];

    quList['北京'] = [ '1区', '2区', '3区', '4区' ];
    quList['杭州市'] = [ '5区', '6区', '7区', '8区' ];
    quList['温州市'] = [ '9区', '10区', '11区', '12区' ];
    quList['西安'] = [ '13区', '14区', '15区', '16区' ];
    quList['宝鸡'] = [ '17区', '18区', '19区', '20区' ];
    quList['兰州市'] = [ '21区', '22区', '23区', '24区' ];

    window.onload = allData;
    function allData() {
    var shengfen = document.getElementById('shengfen');
    for ( var sf in cityList) {
    shengfen.add(new Option(sf, sf));
    }

    }
    function changeCity() {

    var chengshi = document.getElementById('chengshi');
    var sheng = document.getElementById('shengfen').value;

    chengshi.options.length = 1;
    for ( var cs in cityList[sheng]) {
    chengshi.add(new Option(cityList[sheng][cs], cityList[sheng][cs]));

    }
    }

    function changequ() {
    var shiqu = document.getElementById('shiqu');
    var cheng = document.getElementById('chengshi').value;
    shiqu.options.length = 1;
    for ( var sh in quList[cheng]) {

    shiqu.add(new Option(quList[cheng][sh], quList[cheng][sh]));

    }

    }
    </script>
    </head>
    <body>
    <br />

    <select id="shengfen" style="100px" onchange="changeCity()"><option>--选择省份--</option>

    </select>
    <select id="chengshi" style="100px" onchange="changequ()"><option>--选择城市--</option>

    </select>
    <select id="shiqu" style="100px"><option>--选择区县--</option>

    </select>

    </body>
    </html>

  • 相关阅读:
    【监控笔记】【1.5】事件通知(event Notification)
    【监控笔记】【1.4】Pssdiag和Sqldiag管理器
    【监控笔记】【1.3】监控事件系列——SQL Trace(黑盒跟踪 BlackBox Trace)
    sqlserver数据库大型应用解决方案总结
    如何学习MySQL数据库管理员(OCP)认证(转)
    PL/SQL基本操作
    OracleOraDb11g_home1TNSListener服务无法启动
    sqlplus无法登陆?
    SQL Server中的扩展事件学习系列
    docker容器的服务发现:consul
  • 原文地址:https://www.cnblogs.com/chengxuy/p/5891486.html
Copyright © 2020-2023  润新知