实现两个select list box间item的移动和过滤
<head>
<title>
</title>
<!--Standard jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-git2.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#boxClear').click(function(){
$('#firstFilterSearch').val('');
}); $('#firstFilterSearch').keyup(function()
{
var searchArea = $('#firstList');
searchFirstList($(this).val(), searchArea);
}); $('#firstList').dblclick(function() {
assignList();
}); $('#secondList').dblclick(function() {
unassignList();
}); $('#to2').click(function()
{
assignList();
}); $('#to1').click(function()
{
unassignList();
});
}); // Function for Filtering
function searchFirstList(inputVal, searchArea)
{
var allCells = $(searchArea).find('option');
if(allCells.length > 0)
{
var found = false;
allCells.each(function(index, option)
{
var regExp = new RegExp(inputVal, 'i');
if(regExp.test($(option).text()))
{
$(option).show();
}
else
{
$(option).hide();
}
});
}
} // function: UnAssignment
function assignList()
{
$('#firstList :selected').each(function(i, selected){
// append to second list box
$('#secondList').append('<option value="'+selected.value+'">'+ selected.text+'</option>');
// remove from first list box
$("#firstList option[value='"+ selected.value +"']").remove();
});
}
// function: UnAssignment
function unassignList()
{
$('#secondList :selected').each(function(i, selected){
// append to first list box
$('#firstList').append('<option value="'+selected.value+'">'+ selected.text+'</option>');
// remove from second list box
$("#secondList option[value='"+ selected.value +"']").remove();
});
}
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<form id="frm_format" method="" action="">
<table cellpadding="0" id="tbl_format"cellspacing="0" border="0" width="100%" class="standard_table_v4">
<thead>
</thead>
<tbody>
<tr>
<td>
<td align="center">
Filter: <input id="firstFilterSearch" type="text">
<input type="button" id="boxClear" name="boxClear" value="Cancel"><br>
<select id="firstList" multiple="multiple" style="height:420px;width: 250px;" >
<option value="1">PHP</option>
<option value="2">.Net</option>
<option value="3">Copy</option>
<option value="4">Paste</option>
<option value="5">Pea</option>
<option value="6">Pamp</option>
<option value="7">ladaku</option>
<option value="8">Zebra</option>
</select>
</td>
<td align="center">
<input id="to2" type="button" name="to2" title='assign' value=">" /><br/><br/>
<input id="to1" type="button" name="to1" title='unassign' value="<">
</td>
<td>
<select id="secondList" multiple="multiple" style="height:420px;width: 250px;" >
</select>
</td>
</tr>
</tbody>
</table>
</form> </td>
</tr>
</table>
</body>
</html>
实现两个select list box间item的移动和过滤的更多相关文章
- jQuery获取Radio选择的Value值||两个select之间option的互相添加操作(jquery实现)
jQuery获取Radio选择的Value值: 1. $("input[name='radio_name'][checked]").val(); //选择被选中Radio的Val ...
- JSF 2 multiple select dropdown box example
In JSF, <h:selectManyMenu /> tag is used to render a multiple select dropdown box – HTML selec ...
- oracle中,将两个select语句的结果作为一个整体显示出来
如果我们需要将两个select语句的结果作为一个整体显示出来,我们就需要用到union或者union all关键字.union(或称为联合)的作用是将多个结果合并在一起显示出来.union和union ...
- 2017 年 9 月 27 日 js(1.两个select 内容互换 2.单选按钮 同意可点击下一步 3. 全选框)
1.两个select 内容互换 <!DOCTYPE html><html> <head> <meta charset="UTF- ...
- Mysql中两个select语句的连接
Mysql中两个select语句连接需要用到操作符 SQL UNION 操作符 UNION 操作符用于合并两个或多个 SELECT 语句的结果集. 请注意,UNION 内部的 SELECT 语句必须拥 ...
- 两个Select 之间的值的传递
运行效果: 下面是代码: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML ...
- 左右两个Select列表框交换数据的JS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD ...
- SQL语句里合并两个select查询结果
SQL UNION 操作符UNION 操作符用于合并两个或多个 SELECT 语句的结果集. 请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列.列也必须拥有相似的数据类型.同时,每条 ...
- jQuery:实现两个<select>控件的互移操作
一.直接上代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...
随机推荐
- 1203.4——循环语句 之 for
for循环的一般形式为:for(表达式1; 表达式2; 表达式3){ 语句块} 它的执行过程如下:1) 先求解表达式1. 2) 求解表达式2,若其值为真(非0),则执行循环体,否则结束循环. 3 ...
- [转载]OpenSUSE 13.2/13.1 安装搜狗拼音输入法
1. 添加 M17N 源: 13.2: sudo zypper ar -f http://download.opensuse.org/repositories/M17N/openSUSE_13.2/ ...
- 高性能PHP日志插件--Seaslog
日志系统作为记录系统运行的信息,包括 用户输入,安全日志等,日志系统是不能影响用户的使用. 为什么需要记录日志? 既然日志系统增加了整个系统的开销,为什么我还需要它,这是因为日志能帮我们记录运行的很多 ...
- 关于反射中获取Fields,method,Construts简单介绍
* getFields()与getDeclaredFields()区别:getFields()只能访问类中声明为公有的字段,私有的字段它无法访问,能访问从其它类继承来的公有方法.getDeclared ...
- java压缩文件出现中文乱码问题
在项目中需要压缩文件下载,做完了发现有中文乱码问题,终于明白了. 引入ant.jar包 import org.apache.tools.zip.ZipEntry; import org.apach ...
- php的一些小笔记--数组
array_chunk 分割数组 第三个参数确定分割的数组是否维持原样key,默认为false array_column 返回数组指定的列 array_combine 合并数组 第一个数组 ...
- 网关协议学习:CGI、FastCGI、WSGI、uWSGI
一直对这四者的概念和区别很模糊,现在就特意梳理一下它们的关系与区别. CGI CGI即通用网关接口(Common Gateway Interface),是外部应用程序(CGI程序)与Web服务器之间的 ...
- 利用7z实现一键解压
目的: 实现双击zip,7z,rar等文件时自动解压,解压完毕后自动打开文件夹. 工具: [本文末尾附有所有工具的下载地址] 7z.exe types 步骤: 新建"7z-自动解压" ...
- js刷新页面
reload 方法,该方法强迫浏览器刷新当前页面. 语法:location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取当前页 ...
- css显示省略号
white-space:nowrap;overflow:hidden;text-overflow:ellipsis; <!-- 就这三句,,,嘿嘿....->