簡體   English   中英

如何從內部的數據庫表列表中傳輸選定的表 <select></select> 形成另一種形式 <select></select> 形成

[英]How can I transfer the selected table from a list of database tables inside <select></select> form to another <select></select> form

這個場景

這是我目前的代碼:

<div class="column" id="tbDiv">
    <p><b>TABLES</b></p>
    <select name="List of Tables" size="25" multiple id='table1' name='table1' title='List of Tables' class='inputbox'>
        <option>Tables will be listed here...</option></select>
</div> 
</td>

<td>
    <div class="column">                  
        <button onclick="myFunction1()" style="float:right; margin-right:0px;" id="submit1"><<</button>
        <button onclick="myFunction2()" style="float:right; margin-right:0px;" id="submit">>></button>  
     </div>
</td> 
<td>             
    <div class="column">
        <p><b>TABLE(S) TO SYNC</b></p>
        <select name="List of Tables" size="25" multiple name='table1' title='List of selected tables' name="List of Tables" size="20" class='inputbox'>
             <option>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . </option>
        </select>
    </div>
</td>

如何將選定的表格從左側下拉列表中轉移到右側,反之亦然?

我用我認為你正在尋找的東西創造了一個小提琴 使用jQuery非常簡單。

$(document).ready(function(){

    $("#add").click(function(){
        $("#tables option:selected").each(function(){
           $(this).clone().appendTo("#tables_to_sync");
           $(this).remove();
        });
    });

    $("#remove").click(function(){
        $("#tables_to_sync option:selected").each(function(){
           $(this).clone().appendTo("#tables");
           $(this).remove();
        });
    });

});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM