This article is mainly on the multiple-selection list box dynamic Add, move, delete, select all the simple examples of the operation of the introduction, the need for friends can come to the reference, I hope to help you.
Code as follows: <% Dim a = Split (Request.Form ("SourceList"), ",") Response.Write "Source:" & Request.Form ("Sourcelis T ") & UBound (a) &" <br>object: "& Request.Form (" ObjectList ") &" <br> "%> <html> < head> <meta http-equiv= "Content-type" content= "text/html"; charset=gb2312 "> <title>untitled document</title> <style type=text/css>. bgsubleft { Background-position:center Bottom; Background-image:url (images/bgleft.gif); Background-repeat:repeat-x}. bgsubleftn {Background-position:left bottom; Background-image:url (images/bgleftn.gif); Background-repeat:no-repeat} </STYLE> <script language= "JavaScript" type= "Text/javascript" > function Addselectedlist () {var objsource = form1.sourcelist; var objobject = form1.objectlist; var sourcelen = objsource.length; for (Var i=0;i<sourcelen;i++) { if (objsource.options[i].selected) { if (!checkexist) ( Objobject,objsource.options[i].Value) { addtolist (objobject,objsource.options[i].text,objsource.options[i].value); } }}} function addalllist () {var objsource = form1.sourcelist; var objobject = Form1.objectlist; var sourcelen = objsource.length; for (Var i=0;i<sourcelen;i++) { if (!checkexist (Objobject,objsource.options[i].value)) { & nbsp Addtolist (Objobject,objsource.options[i].text,objsource.options[i].value); }} function Removeselectedlist (noremovevalue) {var objobject = form1.objectlist; for (Var i=0;i&l t;objobject.length;i++) { if (objobject.options[i].selected && objobject.options[i].value!= Noremovevalue) { objObject.options.remove (i); Removelist (noremove Value); }} function Removealllist (noremovevalue) {var objobject = form1.objectlist; var Objlen = Objobjec T.length; For (Vari=0;i<objlen;i++) { if (objobject.options[i].value!= noremovevalue) { objobject.opt Ions.remove (i); removealllist (noremovevalue); }} function Selectedall (obj) {for (Var i=0;i<obj.length;i++) { Obj.options[i].sel Ected = true; } function Checkexist (obj,value) {var isexist = false; for (Var i=0;i<obj.length;i++) { if (obj.options [I].value = = value] { isexist = true; break; }} return isexist; function Addtolist (Obj,value,label) {Obj.add (new Option (Value,label));} </script> </head> < Body bgcolor= "#FFFFFF" > <form name= "Form1" action= "temp.asp" method= "POST" > <table width= "$" border= "0" cellspacing= "0" cellpadding= "0" > <tr> <td><select name= "sourceList" size= "ten" multiple Id= "SourceList" style= "width:150" > <option value= "A" >1</option> <option value= "B" >2</option> <option Value= "C" >3</option> <% for i = 6 to/ Response.Write ("<option value=" "& i+200 &" ">" & i+200 & "</option>" & vbCrLf) & nbsp Next %> </select></td> <td><input name= "ad D "type=" button "id=" Add "value=" Add "onclick=" Addselectedlist () "style=" width:100 "><br> <input name= "Add" type= "button" id= "Add" value= "Add All" onclick= "addalllist ()" style= "width:100" ><br> <input name= "Add" type= "button" id= "Add" value= "Remove" onclick= "removeselectedlist (' a ') "Style=" width:100 "><br> <input name=" Add "type=" button "id=" Add "value=" Remove All "onclick=" Removealllist (' a ') "style=" width:100 "> <input name= "Add" type= "button" id= "Add" value= "Select All" onclick= "Selectedall (form1.objectlist ) "style=" width:100 "></td> <td><select name=" objectList "size=" "Multiple id=" ObjectList "style=" width:150 "> <option value=" a ">1</option> <option value= "D" >4</option> <option value= "E" >5</option> & nbsp <% for i = 6 to Response.Write ("<option value=" "" & I & "" ">" & I & "</option>" & vbCrLf) Next %> </select></td> </tr> <tr> <td></td> <td>< Input name= "SUBM" type= "Submit" value= "Submit" style= "width:100" ></td> <td> </td> </tr> </table> </form> </body> </html>