risolto grazie lo stesso,
condivido la mia soluzione x chiunque possa servire
codice:<html> <head> <script language="JavaScript"> Begin <!-- // Add the selected items in the parent by calling method of parent function addSelectedItemsToParent() { self.opener.addToParentList(window.document.forms[0].destList); window.close(); } // Fill the selcted item list with the items already present in parent. function fillInitialDestList() { var destList = window.document.forms[0].destList; //var srcList = self.opener.window.document.forms[0].parentList; for (var count = destList.options.length - 1; count >= 0; count--) { destList.options[count] = null; } for(var i = 0; i < srcList.options.length; i++) { if (srcList.options[i] != null) destList.options[i] = new Option(srcList.options[i].text); } } // Add the selected items from the source to destination list function addSrcToDestList() { destList = window.document.forms[0].destList; srcList = window.document.forms[0].srcList; var len = destList.length; for(var i = 0; i < srcList.length; i++) { if ((srcList.options[i] != null) && (srcList.options[i].selected)) { //Check if this value already exist in the destList or not //if not then add it otherwise do not add it. var found = false; for(var count = 0; count < len; count++) { if (destList.options[count] != null) { if (srcList.options[i].text == destList.options[count].text) { found = true; break; } } } if (found != true) { destList.options[len] = new Option(srcList.options[i].text); len++; } } } } // Deletes from the destination list. function deleteFromDestList() { var destList = window.document.forms[0].destList; var len = destList.options.length; for(var i = (len-1); i >= 0; i--) { if ((destList.options[i] != null) && (destList.options[i].selected == true)) { destList.options[i] = null; } } } // End --> </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function move(fbox,tbox) { var i = 0; if(fbox.value != "") { var no = new Option(); no.value = fbox.value; no.text = fbox.value; tbox.options[tbox.options.length] = no; fbox.value = ""; } } function remove(box) { for(var i=0; i<box.options.length; i++) { if(box.options[i].selected && box.options[i] != "") { box.options[i].value = ""; box.options[i].text = ""; } } BumpUp(box); } function BumpUp(abox) { for(var i = 0; i < abox.options.length; i++) { if(abox.options[i].value == "") { for(var j = i; j < abox.options.length - 1; j++) { abox.options[j].value = abox.options[j + 1].value; abox.options[j].text = abox.options[j + 1].text; } var ln = i; break; } } if(ln < abox.options.length) { abox.options.length -= 1; BumpUp(abox); } } function Moveup(dbox) { for(var i = 0; i < dbox.options.length; i++) { if (dbox.options[i].selected && dbox.options[i] != "" && dbox.options[i] != dbox.options[0]) { var tmpval = dbox.options[i].value; var tmpval2 = dbox.options[i].text; dbox.options[i].value = dbox.options[i - 1].value; dbox.options[i].text = dbox.options[i - 1].text dbox.options[i-1].value = tmpval; dbox.options[i-1].text = tmpval2; } } } function Movedown(ebox) { for(var i = 0; i < ebox.options.length; i++) { if (ebox.options[i].selected && ebox.options[i] != "" && ebox.options[i+1] != ebox.options[ebox.options.length]) { var tmpval = ebox.options[i].value; var tmpval2 = ebox.options[i].text; ebox.options[i].value = ebox.options[i+1].value; ebox.options[i].text = ebox.options[i+1].text ebox.options[i+1].value = tmpval; ebox.options[i+1].text = tmpval2; } } } // End --> </script> </head> <body onLoad="javascript:fillInitialDestList();"> <center> <form method="POST"> <table bgcolor="#FFFFCC"> <tr> <td bgcolor="#FFFFCC" width="17"></td> <td bgcolor="#FFFFCC" width="17"></td> <td bgcolor="#FFFFCC" width="36">Disponibili</td> <td bgcolor="#FFFFCC"></td> <td bgcolor="#FFFFCC" width="69">Selezionati</td> </tr> <tr> <td width="28" bgcolor="#FFFFCC"><input type="text" name="list1" value=""> </td> <td width="17" bgcolor="#FFFFCC"><input type="button" value="Add" onclick="move(this.form.list1,this.form.srcList)" name="B1"> <input type="button" value="Delete" onclick="remove(this.form.srcList)" name="B2"> <input type="button" value="Up" onclick="Moveup(this.form.srcList)" name="B3"> <input type="button" value="Down" onclick="Movedown(this.form.srcList)" name="B4"></td> <td width="36" bgcolor="#FFFFCC"><select size="6" name="srcList" multiple> <option value="1">Item 1 <option value="2">Item 2 <option value="3">Item 3 <option value="4">Item 4 <option value="5">Item 5 <option value="6">Item 6 </select></td> <td bgcolor="#FFFFCC" width="74" align="center"> <input type="button" value=" >> " onClick="javascript:addSrcToDestList()"> <input type="button" value=" << " onclick="javascript:deleteFromDestList();"> </td> <td bgcolor="#FFFFCC" width="69"> <select name="destList"> </select> </td> </tr> <tr> <td align="center"> </td> <td align="center"></td> <td align="center"></td> <td align="center"></td> <td align="center"></td> </tr> </table> </form> </body> </html>


Rispondi quotando