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>


          主站蜘蛛池模板: 太原市| 连江县| 大新县| 手游| 南通市| 乐安县| 繁峙县| 开封县| 吉木乃县| 自治县| 黑山县| 唐河县| 阿克陶县| 石家庄市| 太仆寺旗| 阿鲁科尔沁旗| 潼关县| 延吉市| 肃北| 桐柏县| 从化市| 利川市| 威远县| 泌阳县| 万盛区| 玉山县| 准格尔旗| 永济市| 蒲江县| 绩溪县| 阿克陶县| 望城县| 布尔津县| 巫山县| 昌邑市| 惠水县| 满洲里市| 宁化县| 永兴县| 马关县| 佛坪县|