posts - 165, comments - 198, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          下拉 remove

          Posted on 2008-07-12 17:38 G_G 閱讀(211) 評論(0)  編輯  收藏 所屬分類: HTML




          html

          <!DOCTYPE?html?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"?"http://www.w3.org/TR/html4/loose.dtd">
          <html>
          <head>
          <meta?http-equiv="Content-Type"?content="text/html;?charset=ISO-8859-1">
          <title>Insert?title?here</title>
          </head>
          <body>
          <form?action="">
          ????
          <table>
          ????????
          <tr>
          ????????????
          <td>
          ????????????????
          <select?id="s1"?size="5">
          ????????????????????
          <option>-1-</option>
          ????????????????????
          <option>-2-</option>
          ????????????????????
          <option>-3-</option>
          ????????????????
          </select>
          ????????????
          </td>
          ????????????
          <td>
          ????????????????
          <input?type="button"?value="&gt;&gt;"?onclick="optionRemove('s1','s2');"/>
          ????????????????
          <input?type="button"?value="&lt;&lt;"?onclick="optionRemove('s2','s1');"/>
          ????????????
          </td>
          ????????????
          <td>
          ????????????????
          <select?id="s2"?size="5">
          ????????????????
          </select>
          ????????????
          </td>????????
          ????????
          </tr>
          ????
          </table>
          </form>

          </body>
          <script?type="text/javascript">
          ????
          function?optionRemove(selFromById,selToById){
          ????????
          var?sf?=?document.getElementById(selFromById);
          ????????
          var?st?=?document.getElementById(selToById);
          ????????
          ????????
          var?mo?=??sf.options[sf.selectedIndex];
          ????????
          var?moTest?=??mo.text?;
          ????????
          var?moValue?=?mo.value?;
          ????????
          ????????sf.remove(sf.selectedIndex);?
          ????????st.options.add(
          new?Option(moTest,moValue?),0)

          ????}
          </script>
          </html>


          主站蜘蛛池模板: 连云港市| 昭通市| 乌审旗| 冷水江市| 定日县| 新巴尔虎右旗| 开封市| 仲巴县| 东乌珠穆沁旗| 贵阳市| 泰顺县| 宁南县| 镶黄旗| 尼玛县| 翁牛特旗| 响水县| 长汀县| 华宁县| 新兴县| 荣昌县| 舟曲县| 三江| 区。| 岚皋县| 赫章县| 福安市| 佛冈县| 博兴县| 东海县| 尼木县| 新丰县| 苗栗县| 昂仁县| 柘城县| 乌鲁木齐市| 镇远县| 靖州| 正蓝旗| 章丘市| 汝城县| 澳门|