This article is mainly about the two select multiple selection mode of the option to move the sample code for each other, the need for friends can come to the reference, I hope to help you.
As follows: code is as follows: <! 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=utf-8 "/> <title> Untitled document </title> <script type=" Text/javascript "> Function copytolist (from , to) { var fromlist=eval (' document.forms[0]. ' +from); var tolist=eval (' document.forms[0]. ' +TO); if (toList.options.length > 0 && tolist.options[0].value = ' temp ') { & nbsp tolist.options.length=0; } var sel=false; for (i = 0;i < fromlist.options.length;i++) { var current=fromlist.optio Ns[i]; if (current.selected) { sel=true; &NBSP; if (current.value== ' temp ') { alert (' Can't select this item! '); &NBSP ; return; Txt=current.text; Val=current.value; tolist.options[tolist.length]=new Option (txt,val); fromlist.options[i]=null; i--; } / if (!sel) alert (' You haven't selected any items yet! ') } function Allselect () { var Chsen=document.getelementbyid (' Chosen '); //IF Chsen list box is 0 or the first option value is ' temp ' if (chsen.length && chsen.options[0].value== "temp") return; for (Var i=0;i<chsen.length;i++) { &NBSP; Chsen.options[i].selected=true; } //Get Data function GetData () { var List = document.for Ms[0]. Rolelist; Get a hidden text box object var roles = document.getElementById ("Trolelist"); roles.value = ""; var s = ""; if (list.length!= 0) { for (i = 0; i < list.length i++) { S + + list.opt Ions[i].value + ","; } Roles.value = s; }} </script> </head> <body> <table border= "0" > <form onsubmit= "All Select () "> <tr> &NBSP;&NBsp <td> <select name= "Possible" size= "4" Multiple width= "" style= "width:200px" > & Lt;option value= "1" > China guangzhou </option> <option value= "2" > China Shanghai </option> <option value= "3" > China Beijing </option> <option value= "4" > China Wuhan </option> </select> </td > <td><a href= "javascript:copytolist (' possible ', ' chosen ')" > Add to Right--><br> <br> </a><a href= "javascript:copytolist (' chosen ', ' possible ')" ><--add to left </a ></td> <td> <select name= "Chosen" size= "4" multiple width= "200 " style=" width:200px; > <option value= "Temp" > select your area from the left </option> </select> </td> </tr> </form> </table> <input type= "button" value= "Submit" Onclick= "Allselect ()"/>yle <input type= "TeXT "Style=" Display:none; "id=" trolelist "> </body> </html>