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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incremental Search Select Boxes

Status
Not open for further replies.

Dan777

Programmer
Jul 22, 2000
34
US
Does anyone know how to implement more than single-character searching on a Select Box (drop-down box). For example, suppose I have a select box containing all 50 U.S. states, and the user presses 'M'. Focus in the box is then put on Maine. But if the user presses 'MI', focus in the box goes to Idaho instead of Michigan, because the searching is limited to only one character.

Any help is greatly appreciated!!!
Dan
 
well you could try intersepting the command with something like this:

Code:
function getKey(keyStroke) {

   isNetscape=(document.layers);
	
   eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
	
   whichKey = String.fromCharCode(eventChooser).toLowerCase();

   list(whichKey);
}
document.onkeydown = getKey;

then you could use a function called list to check the key set it to a variable, search the selection items, and scroll the selection box -Greg :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top