Global_run_event_hook = true; Global_combo_array = new Array(); Array.prototype.remove=function(dx) { if(isNaN(dx)||dx>this.length){self.status='Array_remove:invalid request-'+dx;return false} for(var i=0,n=0;i '+arr[i].text+' ' + ''; } str = str + strs.join("") + '' if(this.opslist){this.view.removeChild(this.opslist);} this.opslist = document.createElement("DIV") this.opslist.innerHTML=str; this.opslist.style.display='none'; this.opslist.className = "combo-list"; this.opslist.style.width = this.width.toString()+"px"; this.opslist.onselectstart=returnFalse; this.view.appendChild(this.opslist); } function ComboBox_toggle() { if(this.opslist) { if(this.opslist.style.display=="block") { this.opslist.style.display="none" } else { this.update(); this.build(this.options); this.view.style.zIndex = ++ComboBox.prototype.COMBOBOXZINDEX this.opslist.style.display="block" } } else { this.update(); this.build(this.options); this.view.style.zIndex = ++ComboBox.prototype.COMBOBOXZINDEX this.opslist.style.display="block" } } function ComboBox() { if(arguments.length==0) { self.status="ComboBox invalid - no name arg" } this.name = arguments[0]; this.width = arguments[1]||100; this.par = arguments[2]||document.body; this.index = arguments[3]||0; this.view = document.createElement("DIV"); this.view.style.position='absolute'; this.options = new Array(); this.expops = new Array(); this.value = "" this.build = ComboBox_build this.make = ComboBox_make; this.choose = ComboBox_choose; this.add = ComboBox_add; this.toggle = ComboBox_toggle; this.update = ComboBox_update; this.remove = ComboBox_remove; this.setVal = ComboBox_setValue; this.onChange = null; this.make() this.txtview = this.view.childNodes[0].childNodes[0]; this.valcon = this.view.childNodes[1]; this.par.appendChild(this.view) Global_combo_array[Global_combo_array.length]=this; if(Global_run_event_hook){ComboBox_init()} } ComboBox.prototype.COMBOBOXZINDEX = 800 //change this if you must function ComboBox_init() { if (document.addEventListener) { document.addEventListener("keyup", ComboBox_handleKey, false ); document.addEventListener("mousedown", ComboBox_mouseDown, false ); } else if (document.attachEvent) { document.attachEvent("onkeyup", function () { ComboBox_handleKey(window.event); } ); document.attachEvent("onmousedown", function () { ComboBox_mouseDown(window.event); } ); } Global_run_event_hook = false; } function returnFalse(){return false} function ComboBoxItem(text,value) { this.text = text; this.value = value; }