动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   JavaScript → 阅读文章

 两个列表匡内容互相挪来挪去的例子(javascript)

作者来源: 
阅读 数 182 人次 , 2006-3-29 3:48:00 


代码:

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

 本文Tags组网  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:用javascript调用word文档
· 下一篇:Javascript技术实现真正的网上试听
· JavaScript 制作浮动的工具条
· JavaScript学习:基础继承机制
· html->javascript->jsp(out.println())
· Javascript实例教程(20) 使用HoTMetal(5)
· JavaScript对象系统的使用


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077