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

          下拉 remove

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


          主站蜘蛛池模板: 新河县| 额尔古纳市| 崇文区| 老河口市| 阿克| 江油市| 湘乡市| 临汾市| 汉寿县| 溆浦县| 兴山县| 益阳市| 邵阳市| 南通市| 延吉市| 慈溪市| 康保县| 石景山区| 泽普县| 鄱阳县| 松桃| 沾化县| 环江| 彰武县| 甘泉县| 平湖市| 临洮县| 丰镇市| 西藏| 涿鹿县| 新昌县| 佳木斯市| 陵水| 芒康县| 永胜县| 湄潭县| 大埔县| 兴国县| 清流县| 南平市| 柘荣县|