zoukankan
html css js c++ java
ListBox在客户端添加删除操作
<%
@ 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
>
查看全文
相关阅读:
USACO1.3.3Calf Flac
USACO1.3.1Mixing Milk
USACO1.3.2Barn Repair
USACO2.1.4Healthy Holsteins
USACO1.5.2Prime Palindromes
USACO1.4.2The Clocks
USACO2.1.2Ordered Fractions
PHP关联数组教程
你的服务器没有正确响应Token验证的解决方法
微信公众平台消息接口开发(10)语音触发(非识别)
原文地址:https://www.cnblogs.com/VirtualMJ/p/515396.html
最新文章
为什么项目中总是有很多返工?
OKR失败的五个关键因素
项目进度拖延症的克星 里程碑
OKR究竟适不适合国内企业?
一个项目管理Master的心声
不要被谷歌OKR的胜利冲昏了头脑
PCTS项目管理—时间与成本的把控
改变“速食布丁”式项目管理
处理好人际关系你将收获项目的巨大成功
用PCTS理念做好项目管理规划(优秀项目管理者必知)
热门文章
把存储过程内嵌到内存中,提供运行效率(转帖)
SELECT INTO 和 INSERT INTO SELECT 两种表复制语句(转帖)
USACO1.4.4Mother's Milk
USACO1.3.4Prime Cryptarithm
USACO1.4.3Arithmetic Progressions
USACO2.1.1The Castle
USACO2.1.3Sorting a ThreeValued Sequence
USACO1.5.3Superprime Rib
USACO1.5.1Number Triangles
USACO1.5.4Checker Challenge
Copyright © 2011-2022 走看看