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
>
查看全文
相关阅读:
随便练习的进制转换
回顾快速排序
常用c++函数
POJ 1163 The Triangle
HDU 1155 Bungee Jumping
ZOJ 3861 Valid Pattern Lock
POJ 1273 Drainage Ditches
Hrbust 2240 土豪的时代
POJ 3468 A Simple Problem with Integers
POJ 1061 青蛙的约会
原文地址:https://www.cnblogs.com/CSharp/p/416991.html
最新文章
多行字符串,引号与反引号
angular 的 ng-* 指令绑定方法
js 探究设置值与获取值是否相同
几种js调用刷新界面方式
angular的bootstrap方法
获取当前浏览器的时间
jquery获取文档高度
maven依赖传递---设置 idk
在电脑上如何直接下载秒拍的视频?
hihocoder1049
热门文章
q
如何在博客园添加访客统计+侧栏广告
轮子哥是谁?轮子哥的大学成长路线!轮子哥2005--2009亲身经历!
优先级队列
hdoj 4707 BFS
Java Socket 编程
axure笔记--内部框架交互链接
axure笔记--变量值在页面之间的传递
axure笔记--内置变量
axure快捷键
Copyright © 2011-2022 走看看