<script type ="text/javascript">
function imgRight()
{
var ddlRight=document.getElementById ("LBRight");
var ddlLeft=document.getElementById ("LBLeft");
var count = 0;
for(var i=0;i<ddlLeft.length;i++)
{
count = 0;
if(ddlLeft[i].selected)
{
//查ddlRight在右边是否存在要加的项,如果存在,提示,不加
if(ddlRight.length==0)
{
ddlRight.options.add(new Option(ddlLeft[i].text,ddlLeft[i].value));
document.getElementById ("hiddenLBRightValue").value+=ddlLeft[i].value+","
}
else
{
for(var intRight=0;intRight<ddlRight.length;intRight++)
{
if(ddlRight[intRight].text==ddlLeft[i].text)
{
count++;
}
}
if(count==0)
{
ddlRight.options.add(new Option(ddlLeft[i].text,ddlLeft[i].value));
document.getElementById ("hiddenLBRightValue").value+=ddlLeft[i].value+","
}
}
}
}
}
function imgLeft()
{
var ddlRight=document.getElementById ("LBRight");
for(var i=0;i<ddlRight.length;i++)
{
if(ddlRight[i].selected)
{
ddlRight.remove(ddlRight.selectedIndex);
i--;
}
}
}
function imgUp()
{
var ddlRight=document.getElementById ("LBRight");
var count=0;
if(ddlRight.length!=0)
{
for(var i=0;i<ddlRight.length;i++)
{
if(ddlRight.selectedIndex!=0)
{
if(ddlRight[i].selected)
{
count++;
}
}
else
{
return ;
}
}
if(count!=0)//选中的不是第一项
{
if(ddlRight.selectedIndex<=ddlRight.length-1)
{
//ddlRight.options(ddlRight.selectedIndex).swapNode(ddlRight.options(ddlRight.selectedIndex-1));
var tempSelect=document.createElement ("option");
tempSelect.text=ddlRight.options[ddlRight.selectedIndex].text;
tempSelect.value=ddlRight.options[ddlRight.selectedIndex].value;
ddlRight.options[ddlRight.selectedIndex].text=ddlRight.options[ddlRight.selectedIndex-1].text;
ddlRight.options[ddlRight.selectedIndex].value=ddlRight.options[ddlRight.selectedIndex-1].value;
ddlRight.options[ddlRight.selectedIndex-1].text=tempSelect.text;
ddlRight.options[ddlRight.selectedIndex-1].value=tempSelect.value;
ddlRight.selectedIndex=ddlRight.selectedIndex-1;
}
}
else
{
alert("请先选择要上移的项");
}
}
else
{
alert("该列表中没有数据");
}
}
function imgDown()
{
var ddlRight=document.getElementById ("LBRight");
var count=0;
if(ddlRight.length!=0)
{
for(var i=0;i<ddlRight.length;i++)
{
if(ddlRight.selectedIndex!=ddlRight.length-1)
{
if(ddlRight[i].selected)
{
count++;
}
}
else
{
return ;
}
}
if(count!=0)//选中的不是第一项
{
if(ddlRight.selectedIndex<=ddlRight.length-1)
{
//ddlRight.options(ddlRight.selectedIndex).swapNode(ddlRight.options(ddlRight.selectedIndex-1));
var tempSelect=document.createElement ("option");
tempSelect.text=ddlRight.options[ddlRight.selectedIndex].text;
tempSelect.value=ddlRight.options[ddlRight.selectedIndex].value;
ddlRight.options[ddlRight.selectedIndex].text=ddlRight.options[ddlRight.selectedIndex+1].text;
ddlRight.options[ddlRight.selectedIndex].value=ddlRight.options[ddlRight.selectedIndex+1].value;
ddlRight.options[ddlRight.selectedIndex+1].text=tempSelect.text;
ddlRight.options[ddlRight.selectedIndex+1].value=tempSelect.value;
ddlRight.selectedIndex=ddlRight.selectedIndex+1;
}
}
else
{
alert("请先选择要上移的项");
}
}
else
{
alert("该列表中没有数据");
}
}
分享到:
相关推荐
精彩编程与编程技巧-ListBox项的控制 ...
Angular-angular-dual-listbox.zip,双列表框控件的角度8 组件。角度双列表框,Angularjs于2016年发布,是Angularjs的重写版。它专注于良好的移动开发、模块化和改进的依赖注入。angular的设计目的是全面解决开发人员...
ListBox实现上下左右移动,可以按Ctrl键多选后移到左边的ListBox!
webfrom- ListBox 控件的使用.pdf
wpf--ListBox分组-排序 wpf--ListBox分组-排序
一个Delphi新手写的ListBox左右交换内容例子..rar`
如果你对Delphi中的ListBox控件用法不熟悉,那么本示例会是一个很不错的用法范例,在代码部分,还演示了结合数据库来读取数据交显示到ListBox中的方法。一些ListBox用法代码: if ListBox.ItemIndex>-1 then ...
C#js实现ListBox左边的移动到右边,右边的移动到左边
对偶列表框 ... node_modules/react-dual-listbox/src/less/react-dual-listbox.less node_modules/react-dual-listbox/src/scss/react-dual-listbox.scss 在样式表中包含以下文件之一,或使用CSS
前端项目-bootstrap4-duallistbox,针对Twitter引导优化的响应式双列表框小部件。它适用于所有现代浏览器和触摸设备。
可根据 实验的不同,PCB结构的内容可以作适当的增删)。为了便于处理,程序中的某进程运行 时间以时间片为单位计算。各进程的轮转时间数以及进程需运行的时间片数的初始值均 由用户给定。 2、系统资源(r1…rw),共有w...
Labview中多列列表控件的使用例程,对了解多列列表控件用法有一定帮助。
listbox 上下 左右 滚动条都出现
计算机软件-商业源码-46 响应ListBox控件的滚动条事件.zip
计算机软件-商业源码-47 为ListBox控件添加水平滚动条.zip
替代VB自带的ListBox的控件[McListBox3.rar]-精品源代码
Multi-ListBox控件分成三部分组成,一个是左边的ListBox(FirstListBox),右边的ListBox(SecondListBox)和一个中间的控制面板(Control Panel)。FirstListBox,SecondListBox类似于Asp.net下面的ListBox。它也有...
用vb实现在ListBox控件间移动列表项,一个经典例子极具参考价值
ListboxSortable for Laravel-admin 1.6+ListboxSortable是基于Laravel-admin表单组件的扩展,实现了listbox的拖拽排序功能。RequireLaravel-admin >= 1.6Installation运行下面的命令安装:"composer require ckhan/...
此实例包含FileSystemWatcher类,clListBox背景透明,类的重写,设置控件可以用透明背景Transparent,从不是创建控件“richTextBox1”的线程访问它,利用线程的解决方案,还有无边窗体移动方法,任务栏右侧通知显示...