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
>
查看全文
相关阅读:
AFHTTPRequestOperationManager的那些事
iOS缩放图片
iOS截图
网络服务
Six
正文处理命令及tar命令
用户,群组和权限 四
用户,群组和权限 三
用户,群组和权限 二
用户,群组和权限 一
原文地址:https://www.cnblogs.com/CSharp/p/416991.html
最新文章
hibernate many2one
hibernate 组建映射 (两个表 合并成一张表)
hibernate one2one 联合主键关联 composite key
hibernate one2one
js 延时提示框
Oracle数据exp时报ORA-29275问题解决——字符集不一致
jquery 添加节点的几种方法介绍
html标签name值相同时的获取方法
登录首页时报错:java.lang.IllegalArgumentException (不合法的参数异常)
MyEclipse中出现-访问限制由于对必需的库XX具有一定限制,因此无法访问类型 的解决办法
热门文章
动态绑定事件的方法
ajax的跨域问题
java int类型十进制与十六进制相互转化
对字典转模型模块的理解
iOS遍历类中的属性名runtime
iOS判断某中类型是否来自系统NSFoundation
iOS获得某个实例对象类的全部父类的方法-模仿MJ
iOS 自定义警告提示(方法+宏)--模仿MJ
很不错的博客:runtime
iOS静态库的合并
Copyright © 2011-2022 走看看