<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title>untitled document</title> <script language=" JavaScript "> function AddItem (objform) {var valueary=new Array (); var textary=new Array (); var leftelement=objform.elements["left"]; var rightelement=objform.elements["right"]; var count=0; var I,j,k,flag; for (i=0;i<leftelement.options.length;i++) {if (leftelement.options[i].selected) {valueary[count]=leftelement . Options[i].value; Textary[count]=leftelement.options[i].text; count++; } var Count1=rightelement.options.length; count1=count1>0?count1:0; for (j=0;j<count;j++) {flag=false; for (k=0;k<count1;k++) {if (Rightelement.options[k].text==textary[j]) Flag=true; } if (!flag) {rightelement.options[count1]=new Option (textary[j],valueary[j)); count1++; }} function Subitem (objform) {var i; var objelement=objform.elements["right"]; for (i=objelement.options.length-1;i>=0;i--) {if (objelement.options[i].selected) objelement.options[i]=null ; }} function Addallitem (objform) {var i; var leftelement=objform.elements["left"]; for (i=0;i<leftelement.options.length;i++) {leftelement.options[i].selected=true; } addItem (Objform); } function Suballitem (objform) {var i; var rightelement=objform.elements["right"]; for (i=0;i<rightelement.options.length;i++) rightelement.options[i].selected=true; Subitem (Objform); } </script> </pead> <body> <table width= "0" cellpadding= "cellspacing=" 0 "border=" 0 "> ;form> <tr> <td width= rowspan= "4" ><select name= "left" multiple> <option>ITEM1</option> <option>ITEM2</option> <option>ITEM3</option> <option>ITEM4</option> <option>ITEM5</option> <option>ITEM6</option> &L t;/select></td> <td width= "height=" align= "center" ><input type= "button" value= ">>" Onc lick= "AddItem (this.form);" ></td> <td width= rowspan= "4" align= "right" > <select name= "right" multiple> </select& Gt </td> </tr> <tr> <td width= "align=" "Center" ><input type= "button" value= "<<" onclick= "Subitem (this.form)" ></td> </tr> <tr> <td width= "align=" "Center" ><input Ty Pe= "button" value= "all>>" onclick= "Addallitem (this.form)" ></td> </tr> <tr> <td width= "Align=" "Center" ><input type= "button" value= "<<all" onclick= "Suballitem" (this.form) "></td></tr> </form> </tr> </table> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]