|
-
Nov 13th, 2000, 11:38 AM
#1
Thread Starter
Addicted Member
Hi,
I have a requirement for the following:
In a text box, as a word is being typed the closest match is highlighted in a list box below.
So for example if I start to type
Lon ( for london )
the list below immediately goes to L when I type L, then Lo and so on till I finally rest on London.
I did ( with forum users help ) as similar thing involving dynamic list boxes with a 2D array in JavaScript. I presume this is much more involved.
I just need some pointers i.e.
Can it be done ( I am presuming yes ), major considerations ( time, effort etc ).
Thanks in advance.
Lenin.
-
Nov 17th, 2000, 10:33 AM
#2
Frenzied Member
Is the code for mine:
settime is my form name
Glist is my select list.
NewGuest is my textbox
Code:
function SearchGuest()
{
document.settime.Glist.options[0].selected = true;
var ListLength = document.settime.Glist.length;
var OptionContent='';
var NewContent = document.settime.NewGuest.value;
var ExitFun=false;
if(NewContent!=''){
for(var x=1; x<ListLength;x++){
OptionContent = document.settime.Glist.options[x].text;
OptionContent = OptionContent.toLowerCase();
if(OptionContent.substring(0,NewContent.length)==NewContent.toLowerCase()){
document.settime.Glist.options[x].selected = true;
ExitFun = true;
break;
}
}
}
}
put onkeyup="SearchGuest();" in your input text.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|