coreybryant
asked on
3 level combo box Dynamically
Ref: https://www.experts-exchange.com/questions/21195901/3-level-combo-box-Dynamically.html
Seems to work fine with only numbers. Now I need one with the letters :( - anyone know what I need to change on this one
I need to make 3 level of Combo box
1st one there are three elements 1, 2, 3
If we select 1 then second combobox will enable and it should shows select choice 1.1, 1.2,1.3
If we select 2 then second combobox will enable and it should shows select choice 2.1, 2.2,2.3
If we select 3 then second combobox will enable and it should shows select choice 3.1, 3.2,3.3
If we select 1.1 then third combobox will enable and its should shows select choice 1.1.1, 1.1.2,1.1.3
If we select 1.2 then third combobox will enable and its should shows select choice 1.2.1, 1.2.2,1.2.3
If we select 1.3 then third combobox will enable and its should shows select choice 1.3.1, 1.3.2,1.3.3
Thanks!
-Corey
Seems to work fine with only numbers. Now I need one with the letters :( - anyone know what I need to change on this one
I need to make 3 level of Combo box
1st one there are three elements 1, 2, 3
If we select 1 then second combobox will enable and it should shows select choice 1.1, 1.2,1.3
If we select 2 then second combobox will enable and it should shows select choice 2.1, 2.2,2.3
If we select 3 then second combobox will enable and it should shows select choice 3.1, 3.2,3.3
If we select 1.1 then third combobox will enable and its should shows select choice 1.1.1, 1.1.2,1.1.3
If we select 1.2 then third combobox will enable and its should shows select choice 1.2.1, 1.2.2,1.2.3
If we select 1.3 then third combobox will enable and its should shows select choice 1.3.1, 1.3.2,1.3.3
Thanks!
-Corey
ASKER
Thanks - that looks close but I added
<select name = "mysel2">test1</select>
<select name = "mysel3">test2</select>
because the last drop down seems to be empty?
-Corey
<select name = "mysel2">test1</select>
<select name = "mysel3">test2</select>
because the last drop down seems to be empty?
-Corey
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Gotcha - sorry about that. I think this should work
-Corey
-Corey
Thanks a lot for the points
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script>
function myfunc()
{
var a = document.myform
var b = a.mysel1.selectedIndex
if(a.mysel1.options[b].val
{
var opt = new Option("1.1","1.1","1.1")
var opt1 = new Option("1.2","1.2","1.2")
var opt2 = new Option("1.3","1.3","1.3")
a.mysel2.options[0] = opt;
a.mysel2.options[1] = opt1;
a.mysel2.options[2] = opt2;
}
if(a.mysel1.options[b].val
{
var opt = new Option("2.1","2.1","2.1")
var opt1 = new Option("2.2","2.2","2.2")
var opt2 = new Option("2.3","2.3","2.3")
a.mysel2.options[0] = opt;
a.mysel2.options[1] = opt1;
a.mysel2.options[2] = opt2;
}
if(a.mysel1.options[b].val
{
var opt = new Option("3.1","3.1","3.1")
var opt1 = new Option("3.2","3.2","3.2")
var opt2 = new Option("3.3","3.3","3.3")
a.mysel2.options[0] = opt;
a.mysel2.options[1] = opt1;
a.mysel2.options[2] = opt2;
}
}
</script>
</HEAD>
<BODY>
<form name = "myform">
<select name = "mysel1" onchange = "myfunc();">
<option value = ".">select here </option>
<option value = "1">1</option>
<option value = "2">2</option>
<option value = "3">3</option>
</select>
<select name = "mysel2"></select>
<select name = "mysel3"></select>
</form>
</BODY>
</HTML>