zoukankan
html css js c++ java
写的一个双向选择器(JS)
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
/>
<
title
>
Web双向选择器
</
title
>
<
script
type
="text/javascript"
language
="javascript"
>
function
moveItem(dest, source)
{
var
dest
=
(
typeof
dest
==
"
string
"
?
document.getElementById(dest): dest );
var
source
=
(
typeof
source
==
"
string
"
?
document.getElementById(source) : source );
if
( source.tagName.toLowerCase()
!=
"
select
"
||
dest.tagName.toLowerCase()
!=
"
select
"
)
return
;
for
( index
=
source.length
-
1
; index
>=
0
; index
--
)
{
if
( source[index].selected )
{
dest.length
++
;
dest[dest.length
-
1
].id
=
source[index].id;
dest[dest.length
-
1
].value
=
source[index].value;
dest[dest.length
-
1
].text
=
source[index].text;
source[index]
=
null
;
}
}
}
</
script
>
<
style
type
="text/css"
>
select
{
}
{
margin
:
-2px
;
}
</
style
>
</
head
>
<
body
>
<
table
width
="200"
border
="0"
cellpadding
="0"
cellspacing
="0"
>
<
tr
>
<
td
>
<
select
size
="6"
multiple
="multiple"
id
="left"
ondblclick
="moveItem(right,this)"
>
<
option
value
="def"
>
ListItem1
</
option
>
<
option
value
="abcd"
>
ListItem2
</
option
>
</
select
>
</
td
>
<
td
>
<
input
type
="button"
value
=" > "
name
="btnRight"
onclick
="moveItem(right,left)"
/>
<
input
type
="button"
value
=" < "
onclick
="moveItem(left,right)"
id
="btn"
name
="btnLeft"
/>
</
td
>
<
td
>
<
select
size
="6"
multiple
="multiple"
id
="right"
ondblclick
="moveItem(left,this)"
>
<
option
value
="abc"
>
ListItemm3
</
option
>
<
option
value
="def"
>
ListItem4
</
option
>
<
option
value
="abcd"
>
ListItem5
</
option
>
<
option
value
="abc"
>
ListItem6
</
option
>
<
option
value
="def"
>
ListItem7
</
option
>
<
option
value
="abcd"
>
ListItem8
</
option
>
</
select
>
</
td
>
</
tr
>
</
table
>
</
body
>
</
html
>
查看全文
相关阅读:
【java开发系列】—— 集合使用方法
【java开发系列】—— spring简单入门示例
解决win7远程桌面连接时发生身份验证错误的方法
eoLinker-AMS接口管理系统
CentOS 配置mysql允许远程登录
Linux上安装ZooKeeper并设置开机启动(CentOS7+ZooKeeper3.4.10)
Cent OS home下中文目录改成英文目录
解决redis-cli command not found问题
Centos7使用yum安装Mysql5.7.19的详细步骤(可用)
取消centOS7虚拟机锁屏
原文地址:https://www.cnblogs.com/CSharp/p/416991.html
最新文章
《深度探索c++对象模型》chapter3 Data语意学
vs查看虚函数表和类内存布局
Codeforces 148D Bag of mice 概率dp(水
SharePoint Search之(一):创建Search服务应用程序
【OpenCV新手教程之十一】 形态学图像处理(二):开运算、闭运算、形态学梯度、顶帽、黑帽合辑
呵呵!手把手带你在 IIS 上执行 Python
人人都是产品经理
spring mvc <mvc:annotation-driven>配置使用出现故障
Duanxx的STM32学习:STM32下载方式选择
docker学习笔记(1)
热门文章
Yii2权威指南中文版及众包翻译平台
不借助第三方jar包实现文件上传
【面试虐菜】—— 常用SQL语句
【面试虐菜】—— JAVA面试题(1)
【前端开发系列】—— 文字阴影与样式
【前端开发系列】—— 利用选择器添加内容
【前端开发系列】—— CSS3属性选择器总结
【java开发系列】—— 自定义注解
【java开发系列】—— 嵌套类与内部类
【java开发系列】—— java输入输出流
Copyright © 2011-2022 走看看