通行证│用户名: 密码: 验证码: 验证码,看不清楚?请点击刷新验证码 电信网通铁通移动   在线
资源搜索:
热门搜索:Linux VB C语言 PhotoShop Flash TCP/IP
   首页 | 文章 | 软件 | 动画 | 资源 | 励志 | 骗术 | 论坛 | 邮箱 | 会员中心 | 军事 | 科技 | 博客 | 图片 | 商城 | 最新更新 | 800g资源 | 爱心黑客
您现在的位置: 爱国者黑客 >> 资源 >> WEB开发 >> JavaScript >> 应用技巧 >> 文章正文

两个列表匡内容互相挪来挪去的例子(javascript)
责任编辑:admin   更新日期:2005-8-6


代码:

<HTML>
<HEAD>
<TITLE></TITLE>
<script language="javascript">
function adduser()
{
freelength = document.all.freeid.length;
for (var i=freelength-1;i>=0;i--)
{
if (document.all.freeid.options[i].selected)
{
var newtext = document.all.freeid.options[i].text;
var newvalue = document.all.freeid.options[i].value;
var nowlength = document.all.nowid.length;
document.all.nowid.options[nowlength] = new Option(newtext,newvalue);
document.all.freeid.options[i] = null;
}
}
}

function deluser()
{
nowlength = document.all.nowid.length;
for (var i=nowlength-1;i>=0;i--)
{
if (document.all.nowid.options[i].selected)
{
var newtext = document.all.nowid.options[i].text;
var newvalue = document.all.nowid.options[i].value;
var freelength = document.all.freeid.length;
document.all.freeid.options[freelength] = new Option(newtext,newvalue);
document.all.nowid.options[i] = null;
}
}
}
</script>
</HEAD>
<BODY BGCOLOR="#ffffff" >
<table border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC" width="100%">
<tr>
<td colspan="2">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<select name="freeid" multiple size="6" style="width:200px">

<option value="1">admin</option>

</select>
</td>
<td valign="center" align="center">
<input type="button" class="it" value="添加>>" onclick="adduser()"><br><br>
<input type="button" class="it" value="<<删除" onclick="deluser()">
</td>
<td>
<select name="nowid" multiple size="6" style="width:200px">

<option value="11">EHLDCIO</option>

<option value="15">wanglifeng</option>

<option value="16">service</option>

</select>
</td>
</tr>
</table>
</BODY>
</HTML>

 
  • 上一篇文章:
  • 下一篇文章:
  • 热门文章
    Olldbg常见问题
    汇编语言的艺术(组合语言的艺术)--观
    汇编语言的艺术(组合语言的艺术)--准
    汇编语言的艺术(组合语言的艺术)--基
    汇编语言的艺术(组合语言的艺术)--基
    汇编语言---程式设计 (4)
    虚拟8086模式
    SYS命令使用说明
    javascript + CSS 实现动态菜单显
    推荐文章
    自制Windows XP SP2自动安装光盘
    SQLServer注入工具改进版 v1.02
    使用photoshop CS进行自然美肤
    Photoshop绘制诺基亚手机
    PHOTOSHOP制作秋日之梦
    PHOTOSHOP鼠绘名模王爱萍
    Photoshop制作晶莹飞溅的水珠
    教你用PHOTOSHOP做放大镜
    鼠绘美女及服装修画全过程