I saw a script where when you type someword in textbox and the option field also highlighting the word if was exist in the option field.
for example:
do anyone know any script, thanks!
I saw a script where when you type someword in textbox and the option field also highlighting the word if was exist in the option field.
for example:
do anyone know any script, thanks!
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script type="text/javascript"> /*<![CDATA[*/ function Select(ip,sel){ sel=document.getElementById(sel); var opts=sel.options; var txt=ip.value.split(' '); for (var s,z0=0;z0<opts.length;z0++){ opts[z0].selected=false; s=opts[z0].text.split(' '); for (var z0a=0;z0a<txt.length;z0a++){ for (var z0b=0;z0b<s.length;z0b++){ if (txt[z0a]&&s[z0b]&&txt[z0a].toUpperCase()==s[z0b].toUpperCase()){ opts[z0].selected=true; } } } } } /*]]>*/ </script> </head> <body> <input name="fred" onkeyup="Select(this,'tst');"/> <select name="tst" size="3" multiple="multiple"> <option>Tom</option> <option>****</option> <option>Harry Tom</option> </select> </body> </html>
Vic
God Loves You and will never love you less.
http://www.vicsjavascripts.org/Home.htm
If my post has been useful please donate to http://www.operationsmile.org.uk/
thank you so much, but doesn't seems to highlight anything.
sorry to be rude at the 1st time.
oops
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script type="text/javascript"> /*<![CDATA[*/ function Select(ip,sel){ sel=document.getElementById(sel); var opts=sel.options; var txt=ip.value.split(' '); for (var s,z0=0;z0<opts.length;z0++){ opts[z0].selected=false; s=opts[z0].text.split(' '); for (var z0a=0;z0a<txt.length;z0a++){ for (var z0b=0;z0b<s.length;z0b++){ if (txt[z0a]&&s[z0b]&&txt[z0a].toUpperCase()==s[z0b].toUpperCase()){ opts[z0].selected=true; } } } } } /*]]>*/ </script> </head> <body> <input name="fred" onkeyup="Select(this,'tst');"/> <select id="tst" size="3" multiple="multiple"> <option>Tom</option> <option>****</option> <option>Harry Tom</option> </select> </body> </html>
Vic
God Loves You and will never love you less.
http://www.vicsjavascripts.org/Home.htm
If my post has been useful please donate to http://www.operationsmile.org.uk/
Lozu (09-24-2010)
thanks you so much... works 100%.
Bookmarks