<from><input type="text" name="s1" id="s1">  <select name="select">
    <option>1</option>
    <option>2</option>
    <option>3</option>
  </select>
<input type="button" onclick="copy()" value="copy"> <input type="text" name="s2" id="s2"><select name="select">
    <option>1</option>
    <option>2</option>
    <option>3</option>
  </select></form> 
本人QQ:578787044

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>无标题文档</title>
    <script>
    // JavaScript Document
    function $(d) {return document.getElementById(d);}
    function ChangeItem(ServerList,CurrentServerList)
    {
    var ServerListObject=$(ServerList);
    var CurrentServerListObject=$(CurrentServerList);
    var additemlsit="";
    var additemtext="";
        for(var i=0;i<ServerListObject.length;i++)
    {
      if (ServerListObject[i].selected==true)
    {
      additemlsit=additemlsit+'|'+ServerListObject[i].value;
      additemtext=additemtext+'|'+ServerListObject[i].text;
    }
    }
    var additemlsit=additemlsit.split('|');
    var additemtext=additemtext.split('|');
    if(ServerListObject.options.length>0&&ServerListObject.selectedIndex!=-1)
    {
    for (i=0;i<additemlsit.length;i++)
    {
    if (additemlsit[i]!='')
    {
    var opt=document.createElement("OPTION");
    opt.text=trim(additemtext[i]);
    opt.value=additemlsit[i];
    CurrentServerListObject.options.add(opt);
    ServerListObject.remove(ServerListObject.selectedIndex);
    }
    }
    }
    }
    function ChangeAllItem(ServerList,CurrentServerList)
    {
    var ServerListObject=$(ServerList);
    var CurrentServerListObject=$(CurrentServerList);
    var index=0;
    var length=ServerListObject.options.length;
    while(length>0&&index<length)
    {
    var serverobject=ServerListObject.options[index];
    var opt=document.createElement("OPTION");
    opt.text=serverobject.text;
    opt.value=serverobject.value;
    CurrentServerListObject.options.add(opt);
    index=index+1;
    }
    while(ServerListObject.options.length>0)
    {
    ServerListObject.remove(0)
    }
    ServerListObject.selectedIndex=-1;
    }
    function trim(s){
      return rtrim(ltrim(s)); 
    }
    function trim(s){
      return rtrim(ltrim(s)); 
    }
    //去左空格; 
    function ltrim(s){
      return s.replace( /^\s*/, ""); 

    //去右空格; 
    function rtrim(s){ 
      return s.replace( /\s*$/, ""); 
    }
    </script>
    </head><body><table width="100%" cellpadding="5" cellspacing="0" border="0">
        <tr>
        <td width="40%">
    <select id="ServerList"  style="FONT-SIZE: 11px; WIDTH: 200px; HEIGHT: 200px" multiple size="8" name="ServerList">
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    </select>

    </td>
    <td width="20%" align="center">
    <input style="width:110px" onclick="ChangeItem('ServerList','CurrentServerList')" type=button value="添加>>"><br><br>
    <input style="width:110px" onclick="ChangeItem('CurrentServerList','ServerList')" type=button value="<<删除"><br><br>
    <input style="width:110px" onclick="ChangeAllItem('ServerList','CurrentServerList')" type=button value="全部添加>>"><br><br>
    <input style="width:110px" onclick="ChangeAllItem('CurrentServerList','ServerList')" type=button value="<<全部删除"><br><br>
    </td>
    <td width="40%">
                   <select  id="CurrentServerList" style="FONT-SIZE: 11px; WIDTH: 200px; HEIGHT: 200px" multiple size="8" name="CurrentServerList"></select>
    </td>
    </tr>
    </table>
    </body>
    </html>