> info input) that I need to tie up, i.e., when the DropDownList item changes
(the customer name), the TextBox should reflect the selected value (the
customer number).
If you're working with ASP.NET then it's called "binding", not "tie
up". Will help for googling in the future.
I don't see what it has to do with ASP.NET in this particular cases
(unless you're updating your server data right away).
In the common case:
(I just attached the list scroll to more conventional <Enter> key
press. Also see in this group about select onchange event and some
accessibility issues.)
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<form name="myForm">
<select name="Customers"
onchange="this.form.CustomerID.value=this[selectedIndex].value">
<option selected value="cust1234">John Doe</option>
<option value="cust5678">Michael Smith</option>
<option value="cust9012">Mary Smith</option>
</select>
<br>
<input type="text" name="CustomerID" onkeypress="
var key = event.which || event.keyCode;
if ((key)&&(key==13)) {
var foo = (event.preventDefault) ?
event.preventDefault() :
(event.returnValue = false);
with (this.form.Customers) {
for(i=0; i < options.length; i++) {
if (options[i].value == this.value) {
options[i].selected = true;
break;
}
}
}
}
">
</form>
</body>
</html>