<html> <script language="JavaScript"> function move_lstbox_item(l1, l2) { if (l1.options.selectedIndex>=0) { o=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value); l2.options[l2.options.length] = o; l1.options[l1.options.selectedIndex] = null; } } function enum_lstbox_items(l1, list_options) { list_options.value = ""; for (var i = 0; i < l1.options.length; i++) { list_options.value = list_options.value + l1.options[i].value + ";"; } return true; } </script> <head> </head> <body> Transfer an item from one list to the other with a double click <form name=myform> <select name="lstbox1" size=5 ondblclick="move_lstbox_item(myform.lstbox1, myform.lstbox2)" style=width:200px> <option value="a" selected>Apricot <option value="b">Banana <option value="c">Cherry <option value="d">Doughnut </select> <select name="lstbox2" size=5 ondblclick="move_lstbox_item(myform.lstbox2, myform.lstbox1)" style=width:200px> </select> <input type=hidden name=list_items value=";"> <p> <input type=button name=B_ok value="List items in 2nd listbox" onClick="enum_lstbox_items(myform.lstbox2, list_items);alert(list_items.value)"> </form> </body> </html> |