alohatofu Posted April 25, 2008 Share Posted April 25, 2008 Hello, The code below will make it 2 step conditional. How can I add a 3rd step or a 4th step? Thanks <script language="JavaScript1.2"> function selectCombo() { var aa; var s,ss; var s = myForm1.selectitem1.value; ss = s.split("&"); for (i = 0; i < ss.length ; i++) { myForm1.selectitem2.options[i].text = ss[i]; } } </SCRIPT> <form name=myForm1 > <SELECT id=selectitem1 name=selectitem1 style="HEIGHT: 20px; LIST-STYLE: square; WIDTH: 155px" dataFld="" onChange=selectCombo()> <option value= Item1-1&Item1-2&Item1-3>Item 1</option> <option value= Item2-1&Item2-2&Item2-3>Item 2</option> <option value= Item3-1&Item3-2&Item3-3>Item 3</option> </select> <SELECT id=selectitem2 name=selectitem2 style="HEIGHT: 20px; LIST-STYLE: square; WIDTH: 155px" dataFld="" > <OPTION value=>Item1-1</option> <OPTION value=>Item1-2</option> <OPTION value=>Item1-3</option> </select> </form> Link to comment https://forums.phpfreaks.com/topic/102939-conditional-drop-down-list/ Share on other sites More sharing options...
zenag Posted April 26, 2008 Share Posted April 26, 2008 r u expecting like this???????? <html><head><script language="JavaScript1.2"> function selectcom() { //alert('assss'); var aa; var s,ss; var s = myForm1.selectitem2.value; //alert(s); ss = s.split("&"); //alert(ss); for (i = 0; i < ss.length ; i++) { myForm1.selectitem3.options[i].text = ss[i]; } } function selectCombo() { //alert('assss'); var aa; var s,ss; var s = myForm1.selectitem1.value; ss = s.split("&"); //alert(ss); for (i = 0; i < ss.length ; i++) { myForm1.selectitem2.options[i].text = ss[i]; } } </SCRIPT></head><body> <form name="myForm1" > <SELECT id=selectitem1 name=selectitem1 style="HEIGHT: 20px; LIST-STYLE: square; WIDTH: 155px" dataFld="" onChange="selectCombo()"> <option value= Item1-1&Item1-2&Item1-3>Item 1</option> <option value= Item2-1&Item2-2&Item2-3>Item 2</option> <option value= Item3-1&Item3-2&Item3-3>Item 3</option> </select> <SELECT id=selectitem2 name=selectitem2 onChange="selectcom()"style="HEIGHT: 20px; LIST-STYLE: square; WIDTH: 155px" dataFld="" > <OPTION value= Item1-1-1&Item1-2-2&Item1-3-3>Item1-1</option> <OPTION value= Item2-1-1&Item2-2-2&Item2-3-3>Item1-2</option> <OPTION value= Item3-1-1&Item3-2-2&Item3-3-3>Item1-3</option> </select> <SELECT id=selectitem3 name=selectitem3 onChange=")"style="HEIGHT: 20px; LIST-STYLE: square; WIDTH: 155px" dataFld="" > <OPTION value= >Item1-1</option> <OPTION value= >Item1-2</option> <OPTION value=>Item1-3</option> </select> </form></body></html><? ?> Link to comment https://forums.phpfreaks.com/topic/102939-conditional-drop-down-list/#findComment-527646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.