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
>
查看全文
相关阅读:
Python 异常处理
汉语分词软件的使用 (python底下)
谈谈python的文件处理——文件的输入与输出
统计翻译系统中的开源工具们
研究生如何选定课题方向 如何变学神
口语翻译——AI过程的必经之路
google的盈利模式
机器翻译软件从实验室走向市场
I'm Back
jquery getJSON
原文地址:https://www.cnblogs.com/VirtualMJ/p/515396.html
最新文章
Copy-On-Write in Swift
swift--【do..catch与try,try?,try!】
swift 高级模式匹配 if case
macOS10.12允许所有来源设置
python 中__name__ = '__main__' 的作用,到底干嘛的?
HTML5区块和大纲算法
BlocksKit(2)-DynamicDelegate
BlocksKit(1)-基本类型的分类
javascript类继承的一些实验
【转】responseText,responseBody,responseXML差别
热门文章
js归并排序法
【转】valueof()用法
jquery选择相同ID
【转】javascript打印设置
javascript选择排序
javascript快速排序
博客园上看到边边的时钟,觉得很好看!推荐
[转]CSS3 Media Query实现响应布局
python 字典基本操作
Penn Treebank Tags
Copyright © 2011-2022 走看看