»
EnglishFrenchVietnamese

Print - Change between Dopdown and list box - JavaScriptBank.com

Full version: jsB@nk » Form » Change between Dopdown and list box
URL: https://www.javascriptbank.com/change-between-dopdown-and-list-box.html

Change between Dopdown and list box © JavaScriptBank.comThe code changes between dropdown type to list box by visitors.

Full version: jsB@nk » Form » Change between Dopdown and list box
URL: https://www.javascriptbank.com/change-between-dopdown-and-list-box.html



JavaScript
<SCRIPT>Opts=new Array("Click on check box to open list","TV","Video","DVD","Stereo","Chair")tog=0function Check(){tog=!togSel_len=(tog)?Opts.length:1Selx=document.Form.SelOptSelx.length=Sel_lenSelx.size=Sel_lenSelx.options[0].text =(tog)?"List opened ":"Click box to open list "Selx.options[0].value=""for(s=1;s<Sel_len;s++){Selx.options[s].value=Opts[s]Selx.options[s].text =Opts[s]}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM name=Form><SELECT onchange=alert(this.options[this.selectedIndex].value) name=SelOpt> <OPTION value="Please click the box to open list!" selected>Click on check box to open list</OPTION></SELECT>   <INPUT onclick=Check() type=checkbox value="ON"> </FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->