惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
InfoQ
博客园_首页
美团技术团队
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
J
Java Code Geeks
T
Tailwind CSS Blog
Jina AI
Jina AI
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

博客园 - sun@live

两段代码 <收藏>提高Web性能的14条法则(详细版) MOSS与业务系统的集成 之 单点登录 MOSS与业务系统的集成 之 自定义Membership实现Forms方式验证 手机归属地数据—采集 .Net数据源自定义参数 JavaScript和CSS速查手册 序列化一个字符串到CDATA元素(.NET 1.1) Sandcastle工具SandcastleBuilder 清除字符串数组中,重复元素 - sun@live - 博客园 Windows Live Writer 论坛中,用户权限解决方法 (原创)一个改自java的代码统计工具 Web2.0用户注册,激活,密码找回模块 [学习日志]EyasBlog控件部分已基本完成-2005-12-03 学习日志(blog日历控件)-2005年11月12日 学习日志(Blog架构)-2005年11月09日 学习日志-2005年11月09日 学习计划-2005年11月07日
写的一个双向选择器(JS)
sun@live · 2006-06-04 · via 博客园 - sun@live

<!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>