Jump to content

Recommended Posts

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

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><?

?>


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.