I am wondering if it is possible to modify the number of options in a select box using JS. This is what I have:
[code]html: <select id=”WEAPONSA” onchange=calc()>
<option value=”none”>no SA
<option value=”none”>no SA
<option value=”none”>no SA
<option value=”none”>no SA
<option value=”none”>no SA
</select>
javascript:
var weaponsa=document.forms[‘statcalculator’].WEAPONSA;
weaponsa.options[1] = new Option(WEAPON[weapon][3],WEAPON[weapon][3],false,weaponsa.options[1].selected);
weaponsa.options[2] = new Option(WEAPON[weapon][5],WEAPON[weapon][5],false,weaponsa.options[2].selected);
weaponsa.options[3] = new Option(WEAPON[weapon][7],WEAPON[weapon][7],false,weaponsa.options[3].selected);
weaponsa.options[4] = new Option(WEAPON[weapon][9],WEAPON[weapon][9],false,weaponsa.options[4].selected);
Now, what I’m trying to do is make the select box have differing numbers of options. Most of the time weaponsa.options[4] actually has no options at all in my form except in special cases. So, most of the time weaponsa.options[4] ends up as a blank space, which is unseemly. Is there a way to remove weaponsa.options[4] when there is no value for the selection, so that nothing displays and it cannot be selected?