财神道app下载最新版本-财神到购彩大厅(彩世界)

热门关键词: 财神道app下载最新版本,财神到购彩大厅

JS制作简单的三级联动,财神到购彩大厅

JS制作轻松的三级联合浮动,

用javascript制作的二个粗略三级联合浮动,非常轻巧实用

复制代码 代码如下:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        省:
        <select style="width: 100px;" id="pre" onchange="chg(this);">
            <option value="-1">请选择</option>
        </select>
        市:
        <select style="width: 100px;" id="city" onchange="chg2(this)" ;></select>
        区:
        <select style="width: 100px;" id="area"></select>
财神到购彩大厅,    </body>
    <script>
         //声明省
        var pres = ["北京", "上海", "山东"]; //间接证明Array
         //声明市
        var cities = [
            ["东城", "昌平", "海淀"],
            ["浦东", "高区"],
            ["济南", "青岛"]
        ];
        var areas = [
                [
                    ["东城1", "东城2", "东城3"],
                    ["昌平1", "昌平2", "昌平3"],
                    ["海淀1", "海淀2", "海淀3"]
                ],
                [
                    ["浦东1", "浦东2", "浦东3"],
                    ["高区1", "高区2", "高区3"]
                ],
                [
                    ["济南1", "济南2"],
                    ["青岛1", "青岛2"]
                ]
            ]
            //设置三个省的公共下标
        var pIndex = -1;
        var preEle = document.getElementById("pre");
        var cityEle = document.getElementById("city");
        var areaEle = document.getElementById("area");
         //先设置省的值
        for (var i = 0; i < pres.length; i ) {
            //声明option.<option value="pres[i]">Pres[i]</option>
            var op = new Option(pres[i], i);
            //添加
            preEle.options.add(op);
        }
        function chg(obj) {
            if (obj.value == -1) {
                cityEle.options.length = 0;
                areaEle.options.length = 0;
            }
            //获取值
            var val = obj.value;
            pIndex = obj.value;
            //获取ctiry
            var cs = cities[val];
            //获取暗许区
            var as = areas[val][0];
            //先清空市
            cityEle.options.length = 0;
            areaEle.options.length = 0;
            for (var i = 0; i < cs.length; i ) {
                var op = new Option(cs[i], i);
                cityEle.options.add(op);
            }
            for (var i = 0; i < as.length; i ) {
                var op = new Option(as[i], i);
                areaEle.options.add(op);
            }
        }
        function chg2(obj) {
            var val = obj.selectedIndex;
            var as = areas[pIndex][val];
            areaEle.options.length = 0;
            for (var i = 0; i < as.length; i ) {
                var op = new Option(as[i], i);
                areaEle.options.add(op);
            }
        }
    </script>
</html>

如上所述便是本文的全体内容了,希望大家能够欣赏。

用javascript制作的四个简易三级联合浮动,非常轻松实用 复制代码 代码如下: !DOCTYPE html html head meta charset="utf-8" title/t...

你可能感兴趣的小说:

  • javascript剖判xml完结省市县三级联合浮动的章程
  • javascript读取Xml文件做两个二级联动菜单示例
  • JS XML 省份和城市里面包车型大巴联合浮动完毕代码
  • js达成的举国省市二级联动下拉摘取菜单完整实例
  • PHP Mysql Ajax JS完成省市区三级联合浮动
  • JS实多级联合浮动下拉菜单类,轻巧达成省市区联合浮动菜单!
  • 最佳用的省市二级联合浮动原生js实现您值得拥有
  • jquery json 通用三级联合浮动下拉列表
  • javascript完毕省市区三级联动下拉框菜单
  • js使用xml数据载体完成城市省份二级联合浮动功用

JS制作轻松的三级联合浮动

 本文给大家分享的是运用javascript完成的二个轻易的三级联合浮动菜单,特别轻易实用,有亟待的伙伴过来参照他事他说加以考察下吧。

 

 

用javascript制作的叁个简便三级联合浮动,特别轻易实用

 

代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
省:
<select style="width: 100px;" id="pre" onchange="chg(this);">
<option value="-1">请选择</option>
</select>
市:
<select style="width: 100px;" id="city" onchange="chg2(this)" ;></select>
区:
<select style="width: 100px;" id="area"></select>
</body>
<script>
//声明省
var pres = ["北京", "上海", "山东"]; //间接证明Array
//声明市
var cities = [
["东城", "昌平", "海淀"],
["浦东", "高区"],
["济南", "青岛"]
];
var areas = [
[
["东城1", "东城2", "东城3"],
["昌平1", "昌平2", "昌平3"],
["海淀1", "海淀2", "海淀3"]
],
[
["浦东1", "浦东2", "浦东3"],
["高区1", "高区2", "高区3"]
],
[
["济南1", "济南2"],
["青岛1", "青岛2"]
]
]
//设置一个省的国有下标
var pIndex = -1;
var preEle = document.getElementById("pre");
var cityEle = document.getElementById("city");
var areaEle = document.getElementById("area");
//先设置省的值
for (var i = 0; i < pres.length; i ) {
//声明option.<option value="pres[i]">Pres[i]</option>
var op = new Option(pres[i], i);
//添加
preEle.options.add(op);
}
function chg(obj) {
if (obj.value == -1) {
cityEle.options.length = 0;
areaEle.options.length = 0;
}
//获取值
var val = obj.value;
pIndex = obj.value;
//获取ctiry
var cs = cities[val];
//获取暗中同意区
var as = areas[val][0];
//先清空市
cityEle.options.length = 0;
areaEle.options.length = 0;
for (var i = 0; i < cs.length; i ) {
var op = new Option(cs[i], i);
cityEle.options.add(op);
}
for (var i = 0; i < as.length; i ) {
var op = new Option(as[i], i);
areaEle.options.add(op);
}
}
function chg2(obj) {
var val = obj.selectedIndex;
var as = areas[pIndex][val];
areaEle.options.length = 0;
for (var i = 0; i < as.length; i ) {
var op = new Option(as[i], i);
areaEle.options.add(op);
}
}
</script>
</html>

 

上述所述正是本文的全部内容了,希望大家能够欣赏。

本文给我们大饱眼福的是选取javascript完结的一个简易的三级联动菜单,特别简单实用,有必要的小同伙过来参谋下呢。...

复制代码 代码如下:

连锁小说

相关寻找:

前几日看吗

寻觅技艺库

重返首页

  • iOS9隐蔽手艺:第三方应用消息十分的快回复
  • 小米会利用无边框设计吧?
  • 苹果ios 9新版备忘录涂鸦工具让你轻松
  • iphone自定义怎么修改互联网标记字符
  • iphone 6的Safari密码遮蔽在哪儿
  • iphone6开启限制广告追踪教程

连带频道: HTML/CSS  HTML5  Javascript  jQuery  AJax教程  前面多个代码  正则表达式  Flex教程  WEB前端教程  

如上所述正是本文的全部内容了,希望我们能够欣赏。

帮客商讨

用javascript制作的二个简易三级联合浮动,极其轻易实用

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        省:
        <select style="width: 100px;" id="pre" onchange="chg(this);">
            <option value="-1">请选择</option>
        </select>
        市:
        <select style="width: 100px;" id="city" onchange="chg2(this)" ;></select>
        区:
        <select style="width: 100px;" id="area"></select>
    </body>
    <script>
         //声明省
        var pres = ["北京", "上海", "山东"]; //直接表明Array
         //声明市
        var cities = [
            ["东城", "昌平", "海淀"],
            ["浦东", "高区"],
            ["济南", "青岛"]
        ];
        var areas = [
                [
                    ["东城1", "东城2", "东城3"],
                    ["昌平1", "昌平2", "昌平3"],
                    ["海淀1", "海淀2", "海淀3"]
                ],
                [
                    ["浦东1", "浦东2", "浦东3"],
                    ["高区1", "高区2", "高区3"]
                ],
                [
                    ["济南1", "济南2"],
                    ["青岛1", "青岛2"]
                ]
            ]
            //设置一个省的公家下标
        var pIndex = -1;
        var preEle = document.getElementById("pre");
        var cityEle = document.getElementById("city");
        var areaEle = document.getElementById("area");
         //先设置省的值
        for (var i = 0; i < pres.length; i ) {
            //声明option.<option value="pres[i]">Pres[i]</option>
            var op = new Option(pres[i], i);
            //添加
            preEle.options.add(op);
        }
        function chg(obj) {
            if (obj.value == -1) {
                cityEle.options.length = 0;
                areaEle.options.length = 0;
            }
            //获取值
            var val = obj.value;
            pIndex = obj.value;
            //获取ctiry
            var cs = cities[val];
            //获取默许区
            var as = areas[val][0];
            //先清空市
            cityEle.options.length = 0;
            areaEle.options.length = 0;
            for (var i = 0; i < cs.length; i ) {
                var op = new Option(cs[i], i);
                cityEle.options.add(op);
            }
            for (var i = 0; i < as.length; i ) {
                var op = new Option(as[i], i);
                areaEle.options.add(op);
            }
        }
        function chg2(obj) {
            var val = obj.selectedIndex;
            var as = areas[pIndex][val];
            areaEle.options.length = 0;
            for (var i = 0; i < as.length; i ) {
                var op = new Option(as[i], i);
                areaEle.options.add(op);
            }
        }
    </script>
</html>

本文由财神道app下载最新版本发布于web前端,转载请注明出处:JS制作简单的三级联动,财神到购彩大厅