zoukankan      html  css  js  c++  java
  • 连动html(select)标签操作 原创(create by le)

     代码是最好的解释,请看代码,呵呵!

    代码
      function ChangeCustomId(obj) {
                
    var opt = obj.options[obj.selectedIndex]
                
    //alert("The option you select is:" + opt.text + "(" + opt.value + ")");
     
                
    var opt = obj.options[obj.selectedIndex]
                
    var selectItem = document.getElementsByName("mySelect1");
                
    for (i = 0; i < selectItem.length; i++) {
                    selectItem[i].selectedIndex 
    = obj.selectedIndex;
                }
            }
    <
    select id="mySelect" name="mySelect" onchange="ChangeCustomId(this)"><option>1</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>9</option>
    <option>10</option>
    <option>14</option>
    <option>15</option>
    <option>16</option>
    </select>
                
    </th>

    function ChangeCustomId(obj) {
                var opt = obj.options[obj.selectedIndex]
                //alert("The option you select is:" + opt.text + "(" + opt.value + ")");

                var opt = obj.options[obj.selectedIndex]
                var selectItem = document.getElementsByName("mySelect1");
                for (i = 0; i < selectItem.length; i++) {
                    selectItem[i].selectedIndex = obj.selectedIndex;
                }
            }

  • 相关阅读:
    使用Fiddler捕获Java程序中的HTTP请求
    js解析json对象和json字符串
    写代码 在与思考
    sql 逻辑读取次数
    WbeAPI 学习笔记
    大话设计模式阅读笔记
    行转列
    sql server 的多表查询(left join )
    union 和union all比较
    sql 跨库和域插入数据库
  • 原文地址:https://www.cnblogs.com/chenli0513/p/1865977.html
Copyright © 2011-2022 走看看