ListBox在客户端添加删除操作
来源:互联网 发布:韩顺平php全套笔记 编辑:程序博客网 时间:2024/05/17 02:15
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebExample.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script>
function Add()
{
var elemAll = document.getElementById("lbAll");
var elemSel = document.getElementById("lbSel");
for(var i=0;i<elemAll.options.length;i++)
{
if(elemAll.options[i].selected)
{
var SelText=elemAll.options[i].innerText;
var SelValue = elemAll.options[i].value;
var Num = elemSel.options.length;
elemSel.options[Num]=new Option(SelText,SelValue);
elemAll.options.remove(i);
i--;
}
}
}
function Remove()
{
var elemAll = document.getElementById("lbAll");
var elemSel = document.getElementById("lbSel");
for(var i=0;i<elemSel.options.length;i++)
{
if(elemSel.options[i].selected)
{
var SelText = elemSel.options[i].innerText;
var SelValue = elemSel.options[i].value;
var Num = elemAll.options.length;
elemAll.options[Num]= new Option(SelText,SelValue);
elemSel.options.remove(i);
i--;
}
}
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR>
<TD>
<asp:ListBox id="lbAll" runat="server" Width="100px" Height="150px" SelectionMode="Multiple"></asp:ListBox></TD>
<TD>
<INPUT id="btnAdd" type="button" value=">>" onclick="Add();"><br>
<INPUT id="btnRemove" type="button" value="<<" onclick="Remove();">
</TD>
<TD>
<asp:ListBox id="lbSel" runat="server" Width="100px" Height="150px" SelectionMode="Multiple"></asp:ListBox></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script>
function Add()
{
var elemAll = document.getElementById("lbAll");
var elemSel = document.getElementById("lbSel");
for(var i=0;i<elemAll.options.length;i++)
{
if(elemAll.options[i].selected)
{
var SelText=elemAll.options[i].innerText;
var SelValue = elemAll.options[i].value;
var Num = elemSel.options.length;
elemSel.options[Num]=new Option(SelText,SelValue);
elemAll.options.remove(i);
i--;
}
}
}
function Remove()
{
var elemAll = document.getElementById("lbAll");
var elemSel = document.getElementById("lbSel");
for(var i=0;i<elemSel.options.length;i++)
{
if(elemSel.options[i].selected)
{
var SelText = elemSel.options[i].innerText;
var SelValue = elemSel.options[i].value;
var Num = elemAll.options.length;
elemAll.options[Num]= new Option(SelText,SelValue);
elemSel.options.remove(i);
i--;
}
}
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR>
<TD>
<asp:ListBox id="lbAll" runat="server" Width="100px" Height="150px" SelectionMode="Multiple"></asp:ListBox></TD>
<TD>
<INPUT id="btnAdd" type="button" value=">>" onclick="Add();"><br>
<INPUT id="btnRemove" type="button" value="<<" onclick="Remove();">
</TD>
<TD>
<asp:ListBox id="lbSel" runat="server" Width="100px" Height="150px" SelectionMode="Multiple"></asp:ListBox></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
- ListBox在客户端添加删除操作
- 解决:ListBox 控件在客户端用脚本添加删除项时,后台得不到修改后的数据
- ListBox添加删除
- 两个ListBox通过Botton互操作(添加删除)
- js操作ListBox实现多项的添加和删除
- 在服务器端获取客户端对ListBox的操作
- ListBox操作(绑定、添加、删除、上移、下移、添加全部、删除……)
- ListBox控件的客户端操作
- 在ASP.NET 2.0中操作数据::为删除数据添加客户端确认
- 在web下怎样用javascript向listbox中添加或删除所选定的项!
- ListBox的批量添加和删除
- ListBox多行添加多行删除
- 删除ListBox某项后需要进行的操作
- 对ListBox的添加移除操作
- 操作注册表在添加或删除程序中添加项
- 怎样在选择屏幕中添加LISTBOX
- 在 selection-screen 中添加 listbox
- Excel VBA ListBox列表框添加和删除问题
- 屏蔽页面右键及选择文本的方法
- 日期时间相关操作
- implement of tree menu on database
- Ajax 技术资源中心
- 简单获取键盘的KeyCode
- ListBox在客户端添加删除操作
- 字符串操作
- 异步通信实例(一)Server
- poi(2)解析jar并写入excel
- textarea宽度固定,自动增高,input高度固定,自动增宽
- IOI2006 D2-3:A BLACK BOX GAME(带中文)
- 异步通信实例(二)Client
- IOI2006 D2-1:THE VALLEY OF MEXICO
- IOI2006 D2-2:JOINING POINTS