LOGO OA教程 ERP教程 模切知识交流 PMS教程 CRM教程 开发文档 其他文档  
 
网站管理员

下拉列表左右移动或交换数据代码

admin
2010年3月8日 0:28 本文热度 9869

下拉框的数据来回交换,记得最早是在人才网站选择职位时候发现的这种功能,本款是模仿的,功能有点不一样,只提供一种思路,希望对你有帮助。

​ 

<title>

    列表数据交换

</title><script language="JavaScript">function copyToList(from,to) { 

  fromList = eval('document.forms[0].' + from); 

  toList = eval('document.forms[0].' + to); 

  if (toList.options.length > 0 && toList.options[0].value == 'temp') 

  { 

    toList.options.length = 0; 

  } 

  var sel = false; 

  for (i=0;i<fromList.options.length;i++) 

  { 

    var current = fromList.options[i]; 

    if (current.selected) 

    { 

      sel = true; 

      if (current.value == 'temp') 

      { 

        alert ('你不能选择这个项目!'); 

        return; 

      } 

      txt = current.text; 

      val = current.value; 

      toList.options[toList.length] = new Option(txt,val); 

      fromList.options[i] = null; 

      i--; 

    } 

  } 

  if (!sel) alert ('你还没有选择任何项目'); 

function allSelect() { 

  List = document.forms[0].chosen; 

  if (List.length && List.options[0].value == 'temp') return; 

  for (i=0;i<List.length;i++) 

  { 

     List.options[i].selected = true; 

  } 


</script>

<table border="0">

    <tbody>

        <tr class="firstRow">

            <td>

                <select name="possible" size="4" multiple="" width="200" style="width: 200px"><option value="1">

                    长沙

                </option>

                <option value="2">

                    天津

                </option>

                <option value="3">

                    南京

                </option>

                <option value="4">

                    武汉

                </option>

                <option value="5">

                    郑州

                </option></select>

            </td>

            <td>

                <a href="javascript:copyToList('possible','chosen')">--&gt;<br/> 

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/> 

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</a><a href="javascript:copyToList('chosen','possible')">&lt;--</a>

            </td>

            <td>

                <select name="chosen" size="4" multiple="" width="200" style="width: 200px;"><option value="temp">

                    选择地区

                </option></select>

            </td>

        </tr>

    </tbody>

</table>


该文章在 2026/4/13 19:05:07 编辑过
关键字查询
相关文章
正在查询...
点晴ERP是一款针对中小制造业的专业生产管理软件系统,系统成熟度和易用性得到了国内大量中小企业的青睐。
点晴PMS码头管理系统主要针对港口码头集装箱与散货日常运作、调度、堆场、车队、财务费用、相关报表等业务管理,结合码头的业务特点,围绕调度、堆场作业而开发的。集技术的先进性、管理的有效性于一体,是物流码头及其他港口类企业的高效ERP管理信息系统。
点晴WMS仓储管理系统提供了货物产品管理,销售管理,采购管理,仓储管理,仓库管理,保质期管理,货位管理,库位管理,生产管理,WMS管理系统,标签打印,条形码,二维码管理,批号管理软件。
点晴免费OA是一款软件和通用服务都免费,不限功能、不限时间、不限用户的免费OA协同办公管理系统。
Copyright 2010-2026 ClickSun All Rights Reserved  粤ICP备13012886号-9  粤公网安备44030602007207号