============html=============<div class= "Demo1" > <div> <div class= "MB10" > <input Type= "text" name= "" id= "TXT"/><a id= "Add" href= "javascript:;" > Add </a> </div> <select name= "" id= "Country" > <option value= "> Chinese </ option> <option value= "" > Mongols </option> <option value= "> North Koreans </option> </select> <div class= "pt10" ><a id= "del" href= "javascript:;" > Delete </a></div> </div></div>=============js=========var country=document.getelementbyid (' country '); var Add=document.getelementbyid (' Add '); var txt=document.getelementbyid (' txt '); var del= document.getElementById (' del '); Add.onclick=function () {var option=document.createelement (' option '); o Ption.innerhtml=txt.value;country.appendchild (option);} Del.onclick=function () {var index=country.selectedindex;country.removechild (Country[index]);}
Add and remove content from drop-down boxes