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;
                }
            }

  • 相关阅读:
    SettingWithCopyWarning
    统计运算
    数据清洗
    dataframe 索引
    那些拯救我的快捷键
    如何拒绝那些哭天抢地向你求救结果把你坑了的同事?
    Linux 笔记
    数据可视化:桑基图
    敏捷
    持续集成的概念
  • 原文地址:https://www.cnblogs.com/chenli0513/p/1865977.html
Copyright © 2011-2022 走看看