View Full Version : how to create d dropdown like this

12-03-2002, 06:05 PM
I creating a form and it that I want to create a dropdown menu. But at the same time I want to give the user a flexibility to enter something new or select some thing from the dropdown. How can I do this? (like a combo box)

<select name="country">
<option value="usa">USA</option>
<option value="UK">UK</option>
<option value="canada">Canada</option>

Here the user/administrator of the webpage should be able to add a new country or select an existing one for a particular customer.

12-03-2002, 07:32 PM
adding an entry to the select field:


<SCRIPT TYPE=Text/JavaScript>
function add()
var coun = document.form1.country;
var text = document.form1.input1.value;
var value = document.form1.input2.value;
var option = new Option(text,value);
coun.options[coun.length] = option;


<FORM NAME=form1>
Text for the new entry <INPUT NAME=input1><br>
Value of the new entry <INPUT NAME=input2><br><br>
<INPUT TYPE=button VALUE="Add" NAME=addtext onclick="add()">


<select name="country">
<option value="usa">USA</option>
<option value="UK">UK</option>
<option value="Canada">Canada</option>