-------------
|1 | up
|2 |
|3 | down
|4 |
--------------
样子就像上面那种样子,如果选中2 按下DOWN,数据2就眼数据3的位置交换,点击UP动作相反,这个应该如何实现,用什么控件控制,第一条数据,不可交换
|1 | up
|2 |
|3 | down
|4 |
--------------
样子就像上面那种样子,如果选中2 按下DOWN,数据2就眼数据3的位置交换,点击UP动作相反,这个应该如何实现,用什么控件控制,第一条数据,不可交换
解决方案 »
- 求救(关于生成静态页面的问题)
- testbox visible设为false之后为什么不能输入
- 请教B/S结构的网络视频监控系统例子或思路
- 发邮件时,收不到!怎么让他有返回值呢!
- ASP.NET(C#)中,如何获取 xmlHttp 发送的数据?
- 简单问题一个:【怎么删除几行数据】????
- 在本地服务器上收索网上的符合要求的信息...并且显示在本机上...并且分类进数据库(进来详细看)
- 如何将一按钮定会在屏幕左下角开始菜单的上面?将另一按钮定位在右上角?我不会写代码. :(
- 求可用的天气预报接口
- 关于用户认证签名证书
- <asp:DropDownList></asp:DropDownList>能否让背景透明?
- 问个比较菜的问题。。。
function ListBoxUp()
{
var destinationList=window.document.getElementById("<%=DestinationListBox.ClientID%>");
var destinationLength = destinationList.options.length;
sel_count=0;
for (i=destinationLength-1; i>=0; i--)
{
if(destinationList.options(i).selected)
sel_count++;
} if(sel_count==0)
{
alert("调整已选节点的顺序时,请选择其中一项!");
return;
}
else if(sel_count>1)
{
alert("调整已选节点的顺序时,只能选择其中一项!");
return;
} i=destinationList.selectedIndex;
var temp; if(i!=0)//& i!=1
{
var my_option = document.createElement("OPTION");
my_option.text=destinationList.options(i).text;
my_option.value=destinationList.options(i).value;
if(i<destinationLength-1)
{
var v1 = destinationList.options(i-1).value;
var v2 = destinationList.options(i+1).value;
if(v1 == v2)
{
alert("不能移动,会产生相临的节点!");
return;
}
}
if (i == 1)
temp = destinationList.options(i - 1).value;
if(i>=2)
temp = destinationList.options(i-2).value;
if(my_option.value == temp)
{
alert("不能移到相临的节点处!");
return;
}
else
{
destinationList.add(my_option,i-1);
destinationList.remove(i+1);
destinationList.options(i-1).selected=true;
}
}
SetAllPerson();
} //向下一位
function ListBoxDown()
{
var destinationList=window.document.getElementById("<%=DestinationListBox.ClientID%>");
var destinationLength = destinationList.options.length; sel_count=0;
for (i=destinationLength-1; i>=0; i--)
{
if(destinationList.options(i).selected)
sel_count++;
} if(sel_count==0)
{
alert("调整已选节点的顺序时,请选择其中一项!");
return;
}
else if(sel_count>1)
{
alert("调整已选节点的顺序时,只能选择其中一项!");
return;
} i=destinationList.selectedIndex;
var temp; if (i == 0) {
var my_option = document.createElement("OPTION");
my_option.text = destinationList.options(i).text;
my_option.value = destinationList.options(i).value;
if (i < destinationLength - 2)
temp = destinationList.options(i + 2).value; if (my_option.value == temp) {
alert("不能移到相临的节点处!");
return;
} destinationList.add(my_option, i + 2);
destinationList.remove(i);
destinationList.options(i + 1).selected = true;
}
if(i!=0 & i!=destinationLength-1)
{
var my_option = document.createElement("OPTION");
my_option.text=destinationList.options(i).text;
my_option.value=destinationList.options(i).value;
var v1 = destinationList.options(i-1).value;
var v2 = destinationList.options(i+1).value;
if(v1 == v2)
{
alert("不能移动,会产生相临的节点!");
return;
} if(i<destinationLength-2)
temp = destinationList.options(i+2).value;
if(my_option.value == temp)
{
alert("不能移到相临的节点处!");
return;
} destinationList.add(my_option,i+2);
destinationList.remove(i);
destinationList.options(i+1).selected=true;
}
SetAllPerson();
}
<br />
<br />
<input type="button" class="SmallInput" value=" ↓ " onclick="ListBoxDown();" />//destinationList就是你要操作的LISTBOX