// =================================================================== // Author: Benjamin L?zaro // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. // This script is based on a script found in the following address: // http://www.blazonry.com/javascript/selmenu.php // // =================================================================== function moveSelected(from,to) { newTo = new Array(); for(i=0; i= 0; i--) { items[i] = list.options[i].text; values[i] = list.options[i].value; } for (i = total; i >= 0; i--) { if (index == i) { list.options[i + to] = new Option(items[i],values[i + to], 0, 1); list.options[i] = new Option(items[i + to], values[i]); i--; } else { list.options[i] = new Option(items[i], values[i]); } } list.focus(); /*for(i=0; i=0; i-- ){ if (cmbBox.options[i].text == group ){ cmbBox.options[i].selected = true; } } txtField.value = name; } // add level function addLevel(txtField, cmbBox, lstBox) { name = txtField.value; group = cmbBox.options[cmbBox.selectedIndex].text; levelCreated = name + " / "+ group; newTo = new Array(); var out = new Option(levelCreated, levelCreated); out.selected = true; newTo[newTo.length] = out; for(i=0; i= 0; i--) { if ((lstBox.options[i] != null) && (lstBox.options[i].selected == true)) { lstBox.options[i] = null; } //} txtField.value = "" } } function existInGroup(cmbBox, lstBox) { var text = lstBox.options[lstBox.selectedIndex].text; separator = text.indexOf("/"); var name = text.substring(0,separator - 1); var group = text.substring(separator + 1, text.length); for( i=cmbBox.options.length-1; i>=0; i-- ){ if (cmbBox.options[i].text == group ){ cmbBox.options[i] = null; return(true); } } return(false); } // replace level function replaceLevel(txtField, cmbBox, lstBox) { var maxCnt = lstBox.options.length; if (lstBox.selectedIndex == -1){ alert("Necesita seleccionar un elemento"); return true; } // sustituir name = txtField.value; group = cmbBox.options[cmbBox.selectedIndex].text; levelCreated = name + " / "+ group; var out = new Option(levelCreated, levelCreated); out.selected = true; lstBox.options[lstBox.selectedIndex] = out; } // Replace Option function replaceOption(select,textfield) { var cont = 0; maxItems = eval(select.options.length); if (maxItems == 0) { alert("Necesita seleccionar un elemento"); return true; } else { for(var i=0; i=0; i--){ if (from.options[i].selected == true ) { from.options[i] = null; } } } function moveAll(from,to) { fromLen = from.length ; for (i=0; i