Fork me on GitHub
.net求学者

js操作ListBox列表(select)内移动

 

<script>
function listBoxClick(obj, addName) {
    var $objSelected = $(obj).find("option:selected");
    if ($objSelected && $objSelected.length > 0) {
                $objSelected.appendTo($("#" + addName));
    }
}
function listBoxSetAll(delName, addName) {
    $("#" + delName).children().appendTo($("#" + addName));
}

</script>

<select size="4" name="listBox_Station" multiple="multiple" id="listBox_Station" onDblClick="listBoxClick(this,'listBox_SelectStation');" style="width:300px;height:327px;padding-left: 3px;margin-left:8px;">
</select>

 <span style="display: inline-block;height: 402px;vertical-align: middle;width: 40px;text-align: center;">
                <input type="button" value=" >> " onclick="listBoxSetAll('listBox_Station', 'listBox_SelectStation');" style="font-size:15px;" />
                <br /><br />
                <input type="button" value=" << " onclick="listBoxSetAll('listBox_SelectStation', 'listBox_Station');" style="font-size:15px;" />
</span>
            
<select size="4" name="listBox_SelectStation" multiple="multiple" id="listBox_SelectStation" onDblClick="listBoxClick(this,'listBox_Station');" style="width:300px;height:327px;padding-left: 3px;">
</select> 

 

posted @ 2016-09-22 23:54  hy31337  阅读(412)  评论(0编辑  收藏  举报
.net求学者