»
EnglishFrenchVietnamese

Print - Type choice - JavaScriptBank.com

Full version: jsB@nk » Form » Type choice
URL: https://www.javascriptbank.com/type-choice.html

Type choice © JavaScriptBank.comWhen visitors type the first character of items, the code will automatically display the items that have this character.

Full version: jsB@nk » Form » Type choice
URL: https://www.javascriptbank.com/type-choice.html



JavaScript
<SCRIPT>Chosen=new Array()D=document.forms[0].MultiListfunction SearchFor(str){for(x=0;x<D.length;x++){D.options[x].selected=falseChosen[x]=0if(str.length>0&&D.options[x].value.indexOf(str)>-1){D.options[x].selected=trueChosen[x]=1}}GetOpts()}function GetOpts(){Chsn=""for(x=0;x<D.length;x++){if(Chosen[x]==1) Chsn+=D.options[x].value+"\n"}D.form.Text2.value=Chsn}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=document.forms[0].Srch.focus()><FORM>Type in here <INPUT onblur=GetOpts() onkeyup=SearchFor(this.value) name=Srch size="20"><br>  Options <SELECT multiple size=10 name=MultiList> <OPTION   value=abc>abc<OPTION value=ab1d>ab1d<OPTION value=abc123>abc123<OPTION   value=cbd>cbd<OPTION value=bc12>bc12<OPTION value=jene>jene<OPTION   value=jack>jack<OPTION value=mane>mane<OPTION value=mabc>mabc<OPTION   value=jebc>jebc</OPTION></SELECT><br> Selected   <TEXTAREA name=Text2 rows=6 cols="20"></TEXTAREA> </FORM></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->