Multi-Key Combo box

J

Jon Yates

Hello all.

I'm just wanting to know if there is a free component out
there that will allow multi-key presses in a combo box.
Currently, with the combo box, when you press a key it
moves to the contents that start with that letter. If you
press another key it then moves to another section.
However, what I want is to be able to enter multiple keys.
So if I were to press E N G it would bring up all words
that start ENG.

If there is a free component that would be great but I may
need to write one so if anyone has any advice on that
front, that would be great too!

Cheers all,

Jon
 
V

Vidar Petursson

Hi

Something like this should do it ( not tested )
<html>
<head>
<script>
function doItNow(s){
var str = s.toLowerCase();
var e = document.forms[0].mySelect;
for(i=0;i<e.options.length;i++)
{
if(str.substring(0,str.length) ==
e.options.text.toLowerCase().substring(0,str.length))
{
e.options.selected = true;
break;
}
}
}
</script>
</head>
<body>
<form>
<input type="text" onkeyup="doItNow(this.value)">
<select name="mySelect" size="4">
<option>blast
<option>bor
<option>das
<option>ka
<option>kassi
<option>strange options ;)
<option>strange select options ;)
</select>
</form>
</body>
</html>


Hope this helps and or gives you ideas
--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,017
Latest member
GreenAcreCBDGummiesReview

Latest Threads

Top