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

          下拉 remove

          Posted on 2008-07-12 17:38 G_G 閱讀(212) 評論(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>


          主站蜘蛛池模板: 闻喜县| 台东市| 安吉县| 滨州市| 山东| 高唐县| 金川县| 陵水| 泗洪县| 肥城市| 余江县| 东至县| 荣成市| 平遥县| 吐鲁番市| 威宁| 祁连县| 拉萨市| 恩施市| 出国| 舞钢市| 苏尼特右旗| 台中县| 建水县| 泰兴市| 梅州市| 邢台县| 宁乡县| 墨竹工卡县| 贵溪市| 十堰市| 沿河| 财经| 繁峙县| 海兴县| 武邑县| 紫云| 兴海县| 娄底市| 平度市| 林甸县|