Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make a Drop Down editable

Status
Not open for further replies.

irisngen

Programmer
Jun 17, 2005
215
US
is it possible to make a drop down box with selection, but also give a user the ability to type something else in the box?
 
You can use JavaScript:
Code:
<html>
<head>
<script>
function addOption(theSel){
  oc = theSel.options.length;
  if(theSel.selectedIndex==oc-1){
    newOpt = window.prompt("Enter Address","");
    if(newOpt+"">""){
      theSel.options[oc] = new Option(theSel.options[oc-1].text);
      theSel.options[oc-1] = new Option(newOpt, newOpt, true, true);
    }
  }
}
</script>
</head>
<body>
<form>
<select name="strCcBillAddress" onChange="addOption(this)">
<option>Please select
<option>See Customer Info
<option>Other
</select>
<input type=submit>
</form>
</body>
</html>

__________________________
Corey

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top