»
EnglishFrenchVietnamese

Print - Dropdown Box Population - JavaScriptBank.com

Full version: jsB@nk » Form » Dropdown » Dropdown Box Population
URL: http://www.javascriptbank.com/dropdown-box-population.html

Dropdown Box Population © JavaScriptBank.comThis series of dropdown boxes are automatically populated with choices based on the first dropdown box. Pretty handy!

Full version: jsB@nk » Form » Dropdown » Dropdown Box Population
URL: http://www.javascriptbank.com/dropdown-box-population.html



JavaScript
<SCRIPT>Opts=new Array()Opts[1]=new Array("car","house","boat")Opts[2]=new Array("tom","dick","harry")function ShowSelect(x){for(n=0;n<3;n++){document.forms[0].Sel.options[n].value=Opts[x][n]document.forms[0].Sel.options[n].text=Opts[x][n]}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM><TABLE cellSpacing=0 border=0>  <TBODY>  <TR>    <TD width=200><INPUT onclick=ShowSelect(this.value) type=radio value=1       name=OnOff> Click to open list 1<BR><INPUT onclick=ShowSelect(this.value)       type=radio value=2 name=OnOff> Click to open list 2<BR>    <TD width=200><SELECT name=Sel> <OPTION         selected><OPTION><OPTION><OPTION><OPTION></OPTION></SELECT> </TR></TBODY></TABLE></FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->