<HTML>
<HEAD>
<SCRIPT>
<!--
FUNCTION combotext_onkeydown(e,oText,oSelect){
keyCode = e.keyCode;
IF (keyCode == 40 || keyCode == 38) {
oSelect.style.display = 'block';
oSelect.FOCUS();
comboselect_onchange(oSelect, oText);
}
ELSE IF (keyCode == 13) {
e.cancelBubble = TRUE;
IF (e.returnValue) e.returnValue = FALSE;
IF (e.stopPropagation) e.stopPropagation();
comboselect_onchange(oSelect, oText);
oSelect.style.display='none';
oText.FOCUS();
RETURN FALSE;
}
ELSE IF(keyCode == 9) RETURN TRUE;
ELSE { //alert(keyCode);
oSelect.style.display = 'block';
VAR c = String.fromCharCode(keyCode);
c = c.toUpperCase();
toFind = oText.value.toUpperCase() + c;
FOR (i=0; i < oSelect.options.length; i++){
nextOptionText = oSelect.options.text.toUpperCase();
IF(toFind == nextOptionText){
oSelect.selectedIndex = i;
BREAK;
}
IF(i < oSelect.options.length-1){
lookAheadOptionText = oSelect.options[i+1].text.toUpperCase() ;
IF( (toFind > nextOptionText) &&
(toFind < lookAheadOptionText) ){
oSelect.selectedIndex = i+1;
BREAK;
}
}
ELSE {
IF(toFind > nextOptionText){
oSelect.selectedIndex = oSelect.options.length-1; // stick it at the end
BREAK;
}
}
}
}
}
FUNCTION comboselect_onchange(oSelect,oText) {
IF(oSelect.selectedIndex != -1)
oText.value = oSelect.options[oSelect.selectedIndex].text;
}
FUNCTION comboselect_onkeyup(keyCode,oSelect,oText){
IF (keyCode == 13) {
comboselect_onchange(oSelect, oText);
oSelect.style.display='none';
oText.FOCUS();
}
}
// -->
</SCRIPT>
<body onclick="document.getElementById('selectInput').style.display='none'">
<FORM NAME=form1>
<DIV STYLE="position:relative">
<INPUT TYPE="text"
NAME=textInput
SIZE=18
AUTOCOMPLETE="OFF"
ONKEYDOWN="combotext_onkeydown(event, this, this.form.selectInput)">
<SELECT NAME=selectInput
SIZE=8
STYLE="display:none; position:absolute; top:20px; left:0px"
ONBLUR="this.style.display='none'"
ONCHANGE="comboselect_onchange(this, this.form.textInput)"
ONKEYUP="comboselect_onkeyup(event.keyCode, this, this.form.textInput)">
<OPTION VALUE="Kansas City">Kansas City</OPTION>
<OPTION VALUE="Overland Park">Overland Park</OPTION>
<OPTION VALUE="St. Louis">St. Louis</OPTION>
</SELECT>
<DIV>
</FORM>
<BODY>
</HTML>