<center>
<table>
<tr align="center">
<td colspan="3">
选择
</td>
</tr>
<tr>
<td>
<select id="fb_list" name="fb_list" multiple="multiple"
size="8" style="width: 300px; height:200px;">
</select>
</td>
<td>
<input type="button" id="selectup" name="selectup" value="上移∧" />
<br />
<input type="button" id="add" name="add" value="添加>>" />
<br />
<input type="button" id="delete" name="delete" value="<<移除" />
<br />
<input type="button" id="selectdown" name="selectdown" value="下移∨" />
</td>
<td>
<select id="select_list" name="select_list" multiple="multiple"
size="8" style="width: 300px; height:200px;">
</select>
</td>
</tr>
</table>
</center>
$(function(){
$.post('testAction!excute.action',null,function(data){
// var to_data = eval('('+data+')');
var array = eval(data);
var obj = document.getElementById("fb_list");
var value = "";
for(var i=0;i<array.length;i++){
value = array[i].id + "/" + array[i].name + "/" + array[i].tel;
obj.options[i] = new Option(value,value);
//obj.add(newOption);
}
})
});
//向右移动
$(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("请选择要删除的分包!");
}
})
})
//向上移动
$(function(){
$("#selectup").click(function(){
if($("select[name='fb_list'] option:selected").length > 0){
$("select[name='fb_list'] option:selected").each(function(){
$(this).prev().before($(this));
})
}else{
alert("请选择要移动的数据!");
}
})
})
//向下移动
$(function(){
$("#selectdown").click(function(){
if($("select[name='fb_list'] option:selected").length > 0){
$("select[name='fb_list'] option:selected").each(function(){
//$(this).next().after($(this));
$(this).insertAfter($(this).next());
})
}else{
alert("请选择要移动的数据!");
}
})
})
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有