Select Search
Note: The only browser/os combinations that support this script are Internet Explorer 5.0, 5.5, and 6.0 on Windows.
This select box behaves differently than the usual textbox when it has focus and you use the keyboard. Rather than three consecutive presses of the letter a resulting in "Algeria" being selected, it would look for an entry with the first three letters being "aaa" and if found select it. Try clicking in the select box and typing a - n - t - i. You'll see that "Antigua and Barbuda" is selected.
Use the backspace key to remove a character at a time from the internally stored string you've typed in that is trying to be matched against the option values.
Use the escape key to reset the string and the select box
While building this form, however, I was reminded of why select boxes don't work like this — you can't remember what you've typed in so far. Consequently, I decided that the only conscientious way to build this would be permit the usual method to still work, effectively allowing this functionality to extend the <select>'s current behavior. Without this, the only time it would be appropriate to use this is when you're creating a web-based, non-publicly accessible, application that's intended to replace a system that uses this sort of form widget and the users of the system are dependent on it for efficiency. Obviously this doesn't leave much chance without the caveat I placed on myself when building this.
Updates:
Arrow keys now work properly. [2002-Jan-22]
The blur event now clears the selectedString propery meaning future interaction with the element via the keyboard will create a new string to match against. [2002-Jan-22]
The select now properly supports the default behavior of pressing a-a-a and having the third <option> selected if there isn't an <option> whose text value begins with "aaa". [2002-Jan-22]
Now available as a behavior. [2002-Feb-1]
Known Issues:
This extended functionality doesn't play nice with non-alphanumeric characters. [2002-Feb-25]