http://www.blogjava.net/absolutedo/archive/2009/02/20/255790.html
<table width="95%" cellpadding="0" align="center" class="listshow" border="1" cellspacing="0">
<tr>
<td colspan="4" align="center">选择分包</td>
</tr>
<tr>
<td class="black" width="30%" align="center" height="150">
<select id="fb_list" multiple="multiple" style="text-align:center;width:300px;height:150px;">
</select>
</td>
<td align="center" width="5%">
<input type="button" id="add" value="添加>>" />
<br/>
<br/>
<input type="button" id="delete" value="<<删除" />
</td>
<td class="black" width="30%" align="center">
<select id="select_list" multiple="multiple" style=" text-align:center;width:300px;height:150px;">
</select>
</td>
</tr>
</table>
jQuery代码:
/**
*动态的给左边的下拉列表创建选项
*具体情况可以从数据库读取数据动态创建选项
*/
$(document).ready(function(){
for(var i=1;i<=5;i++)
{
$("#fb_list").append("<option value='"+i+"'>公开招标小型机采购00"+i+"</option>");
}
})
$(function(){
$("#add").click(function(){
if($("#fb_list option:selected").length>0)
{
$("#fb_list option:selected").each(function(){
$("#select_list").append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option");
$(this).remove();
})
}
else
{
alert("请选择要添加的分包!");
}
})
})
$(function(){
$("#delete").click(function(){
if($("#select_list option:selected").length>0)
{
$("#select_list option:selected").each(function(){
$("#fb_list").append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option");
$(this).remove();
})
}
else
{
alert("请选择要删除的分包!");
}
})
})
分享到:
相关推荐
简单实用的jquery select2组件
一组经过美化的jQuery select下拉框单选和多选插件,带搜索功能,模拟select下拉框多选菜单选择效果。
jquery select下拉菜单美化搜索框样式代码
jquery select2 html select 内容搜索 下拉框搜索
代码简介:jQuery Select下拉框美化特效是一款绿色清新风格的带有滚动条下拉框代码。
jQuery select下拉框美化代码基于jquery.1.10.2.min.js制作,点击下拉框,显示下拉框内容。
jquery select表单提交省市区城市三级联动 jquery select表单提交省市区城市三级联动 jquery select表单提交省市区城市三级联动 jquery select表单提交省市区城市三级联动
jQuery Select(单选) 模拟插件 V1.3.6
80、jquery select下拉框美化代码
jQuery Select下拉框关键字匹配查询选择代码
jquery select2 select美化插件
jquery.searchableSelect。select插件,jQuery下拉选择框代码。带搜索功能的选择框代码。
Jquery select 插件 select
jquery select 选中表单特效select城市选择三级 jquery select 选中表单特效select城市选择三级 jquery select 选中表单特效select城市选择三级 jquery select 选中表单特效select城市选择三级
jquery select列表选择框选中美化效果源码
jquery select 样式框架 很好用的框架
selectclass:’ddl-select’,//选框样式 listboxclass:’ddl-listbox’,//展开的列表框样式 selected:[],//选中的对象value, data:{},//数据,格式:{value:name} onchange:function(text,value){ //回调函数 ...
jquery select 选中值设置左右select选择互换 jquery select 选中值设置左右select选择互换
jquery select日历选择器点击select框弹出日期选择器 jquery select日历选择器点击select框弹出日期选择器 jquery select日历选择器点击select框弹出日期选择器 jquery select日历选择器点击select框弹出日期选择器
,默认一个input输入框,点击后下拉框可以快速选择今天,或者过去七天、过去一年时间、上个月时间等快捷选择方式,或者弹出日历选择器提供选择