zoukankan      html  css  js  c++  java
  • JQuery 操作 ListBox间移动和ListBox内移动

      function ListBox_Move(listfrom,listto)
            {
                var size = $("#" + listfrom + " option").size();
                var selsize = $("#" + listfrom + " option:selected").size();
                if(size>0 && selsize>0)
                {
                    $.each($("#"+listfrom+" option:selected"), function(i,own){
    //                    var sText = $(own).text();
    //                    var sValue = $(own).val();
    //                    $("#" + listto).append("<option value=\"" + sValue + "\">" + sText + "</option>");
    //                    $(own).remove();
                        $(own).appendTo($("#" + listto));
                        $("#" + listfrom + "").children("option:first").attr("selected",true);
                    });
                }
            }
           
            function ListBox_Order(ListName,action)
            {
                var size = $("#"+ListName+" option").size();
                var selsize = $("#"+ListName+" option:selected").size();
                if(size > 0 && selsize > 0)
                {
                    $.each($("#"+ListName+" option:selected"),function(i,own){
                        if(action == "up")
                        {
                            $(own).prev().insertAfter($(own));
                        }
                        else if(action == "down")//down时选中多个连靠则操作没效果
                        {
                            $(own).next().insertBefore($(own));
                        }
                    })
                }
            }
          
  • 相关阅读:
    文本检测和识别 代码结构梳理
    UnicodeDecodeError: 'utf-8' codec can't decode byte
    GPU 显存释放
    DCM 图片查看
    hive SQL 字母大小写转换
    vim常用命令之多行注释和多行删除
    js 模拟call、apply、bind实现
    CommonJS、AMD、CMD和ES6模块化区别
    js setTimeout setInterval 第三个参数说明
    js instanceof 实现原理
  • 原文地址:https://www.cnblogs.com/dfg727/p/listbox.html
Copyright © 2011-2022 走看看