zoukankan
html css js c++ java
如何在客户端对ListBox进行添加删除操作
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
>
查看全文
相关阅读:
决策树算法系列之一 ID3
线性递归数列算法题
Python爬虫快速上手教程
gensim快速上手教程
GCN和GCN在文本分类中应用
命名实体如何进行概念消歧?
浅谈神经网络中的激活函数
nginx安装配置和基本使用
netty学习总结(三)
netty学习总结(二)
原文地址:https://www.cnblogs.com/newwind521/p/483816.html
最新文章
Java内存模型
多线程中对static和volatile的理解
log4j 输出格式控制
log4j配置详解
byte转换为十六进制时,Integer.toHexString需要&FF的原因
记一次在mac上配置Maven 的JAVA_HOME的惨痛经历
关于java中的getClass()
iOS7/Object-C ViewController的生命周期
解决Xcode 的 undefined symbols for architecture i386 问题
python随笔.文件打开方式.open
热门文章
HBase【操作Java api】
【转载】HBase基本数据操作详解【完整版,绝对精品】
Hbase(二)【shell操作】
Hbase(一)【入门安装及高可用】
Hadoop【LZO压缩配置】
Sqoop
Kafka(一)【概述、入门、架构原理】
Flume对接Kafka
图像GIST特征和LMGIST包的python实现(有github)
Jupyter Notebook的配置(密码端口+远程登陆+nbextension)
Copyright © 2011-2022 走看看