通过select实现了内容互相移动的效果。如图所示效果。 有关代码: <!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>Untitled Document</title> <mce:script type="text/javascript"><!-- function addItem(objFrom,objTo){ for(var i = 0; i < objFrom.options.length;i++){ if(objFrom.options[i].selected == true){ var selectItem = new Option(objFrom.options[i].text,objFrom.options[i].value); objTo.options.add(selectItem); objFrom.options.remove(i); } } sortItem(objTo); } function allAddItem(objFrom,objTo){ for(var i = objFrom.options.length - 1;i>=0;i--){ var objItem = new Option(objFrom.options[i].text,objFrom.options[i].value); objTo.options.add(objItem); objFrom.options.remove(i); } sortItem(objTo); } function sortItem(objTo){ var ln = objTo.options.length; var arrText = new Array(); var arrValue = new Array(); for(var i=0;i<ln;i++){ arrText[i] = objTo.options[i].text; } arrText.sort(); for(var i=0;i<ln;i++){ for(var j = 0;j<objTo.options.length;j++){ if(arrText[i] == objTo.options[j].text){ arrValue[i] = objTo.options[j].value; break; } } } while(ln--){ objTo.options[ln] = null; } for(i = 0;i<arrText.length;i++){ objTo.add(new Option(arrText[i],arrValue[i])); } } // --></mce:script> </head> <body> <table> <tr> <td>Color Code </td> <td></td> <td>Sample Order </td> </tr> <tr> <td> <select id="selectColor" multiple="multiple" style="width:200px;height:200px;"> <option value="Black">Black</option> <option value="Blue">Blue</option> <option value="DK-RS">DARK RINSE</option> <option value="DK-SW">DARK STONEWASH</option> <option value="Green">Green</option> <option value="MD-SL">MED SANDBLAST</option> <option value="MD-SW">MED STONEWASH</option> <option value="NA">Not applicable</option> <option value="Yellow">Yellow</option> <option value="Red">Red</option> </select> </td> <td> <table> <tr> <td><input type="button" id="btn1" value="-> " οnclick="addItem(selectColor,selectSo)"/></td> </tr> <tr> <td><input type="button" id="btn2" value="->>" οnclick="allAddItem(selectColor,selectSo)"/></td> </tr> <tr> <td><input type="button" id="btn3" value="<<-" οnclick="allAddItem(selectSo,selectColor)"/></td> </tr> <tr> <td><input type="button" id="btn4" value="<- " οnclick="addItem(selectSo,selectColor)"/></td> </tr> </table> </td> <td> <select id="selectSo" multiple="multiple" style="width:200px;height:200px;"> </select> </td> </tr> </table> </body> </html>