Add or remove options from select form control
<HTML> <HEAD> <SCRIPT LANGUAGE=JavaScript> function butRemoveWed_onclick() { if (document.form1.theDay.options[2].text == "AAA") { document.form1.theDay.options[2] = null; } else { alert('There is no AAA here!'); } } function butAddWed_onclick() { var i; var days = document.form1.theDay; var lastoption = new Option(); days.options[6] = lastoption; for (i = 6;i > 2; i--) { days.options[i].text = days.options[i - 1].text; days.options[i].value = days.options[i - 1].value; } var option = new Option("AAA",2); days.options[2] = option; } </SCRIPT> </HEAD> <BODY> <FORM NAME=form1> <SELECT NAME=theDay SIZE=5> <OPTION VALUE=0 SELECTED>111 <OPTION VALUE=1>222 <OPTION VALUE=2>AAA <OPTION VALUE=3>333 <OPTION VALUE=4>444 <OPTION VALUE=5>555 <OPTION VALUE=6>666 </SELECT> <BR> <INPUT TYPE="button" VALUE="Remove AAA" NAME=butRemoveWed onclick="butRemoveWed_onclick()"> <INPUT TYPE="button" VALUE="Add AAA" NAME=butAddWed onclick="butAddWed_onclick()"> <BR> </FORM> </BODY> </HTML>