function cmb_selectByValue(elementId, valueToSelect) { var comboElement = document.getElementById(elementId); for (var i = 0; i < comboElement.options.length; i++) { if ( comboElement.options[i].value == valueToSelect ) comboElement.options[i].selected = "1"; } } function cmb_clear(elementId) { var comboElement = document.getElementById(elementId); comboElement.length=0; } function cmb_newOption(elementId, cvalue, ctext) { var comboElement = document.getElementById(elementId); comboElement.options[comboElement.length] = new Option(ctext, cvalue); } function cmb_removeOption(elementId) { var comboElement = document.getElementById(elementId); if ( comboElement.selectedIndex == -1 ) return false; else for( i=comboElement.options.length-1; i>=0; i-- ) { if( comboElement.options[i].selected ) comboElement.remove(i); } return true; }