function zxcPopulate(zxcid,zxcary){ var zxcsel=document.getElementById(zxcid); zxcsel.options.length=0; for (var zxc0=0;zxc0<zxcary.length;zxc0++){ zxcsel.options[zxc0]=new Option(zxcary[zxc0][0],zxcary[zxc0][1],true,true); } zxcsel.selectedIndex=0; }
@shd05017authorJan 16.2008 — #thanks, but thats not quite what i meant. sorry its probably the way i worded it. i dont have the items of my array, they are created by words entered into a text box. so everytime they enter somethin new i need it to be displayed in a select box, not a list box. sorry, my mistake. hope you guys can still help me
function zxcPopulate(zxcid,zxcip){ var zxcsel=document.getElementById(zxcid); var zxcval=document.getElementById(zxcip).value; if (zxcval.length==0) return; for (var zxc0=0;zxc0<zxcsel.options.length;zxc0++){ if (zxcsel.options[zxc0].text==zxcval) return; } zxcsel.options[zxcsel.options.length]=new Option(zxcval,'',true,true); zxcsel.selectedIndex=0; }