Hi there
I have used a script available on the internet for a multiple drop down box ( Country/State/City ). Once the selection is updated I would like 3 different set of result to show in box : Result could be value or text.
Using the below script I am not familiar with what function to use to return the result of the search in 3 different box
Any idea someone please ?
Sydney
<script language="JavaScript" type="text/javascript">
<!--
// first combo box
data_1 = new Option("COuntry A", "-");
data_2 = new Option("Country B", "-");
// second combo box
data_1_1 = new Option("State A1", "-");
data_2_1 = new Option("State B1 ", "--");
d
// third combo box
data_1_1_1 = new Option("City A11", "*");
data_1_1_2 = new Option("City A12", "*");
// fourth combo box
data_1_1_1_1 = new Option("15 GBP", "*");
data_1_1_2_1 = new Option("16 GBP", "*");
// fifth combo box
data_1_1_1_1 = new Option("15 GBP", "*");
data_1_1_2_1 = new Option("16 GBP", "*");
// sixth combo box
data_1_1_1_1 = new Option("15 GBP", "*");
data_1_1_2_1 = new Option("16 GBP", "*");
// other parameters
displaywhenempty=""
valuewhenempty=-1
displaywhennotempty="-select-"
valuewhennotempty=0
function change(currentbox) {
numb = currentbox.id.split("_");
currentbox = numb[1];
i=parseInt(currentbox)+1
// I empty all combo boxes following the current one
while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
(document.getElementById("combo_"+i)!=null)) {
son = document.getElementById("combo_"+i);
// I empty all options except the first one (it isn't allowed)
for (m=son.options.length-1;m>0;m--) son.options[m]=null;
// I reset the first option
son.options[0]=new Option(displaywhenempty,valuewhenempty)
i=i+1
}
// now I create the string with the "base" name ("stringa"), ie. "data_1_0"
// to which I'll add _0,_1,_2,_3 etc to obtain the name of the combo box to fill
stringa='data'
i=0
while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
(document.getElementById("combo_"+i)!=null)) {
eval("stringa=stringa+'_'+document.getElementById(\"combo_"+i+"\").selectedIndex")
if (i==currentbox) break;
i=i+1
}
// filling the "son" combo (if exists)
following=parseInt(currentbox)+1
if ((eval("typeof(document.getElementById(\"combo_"+following+"\"))!='undefined'")) &&
(document.getElementById("combo_"+following)!=null)) {
son = document.getElementById("combo_"+following);
stringa=stringa+"_"
i=0
while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0)) {
// if there are no options, I empty the first option of the "son" combo
// otherwise I put "-select-" in it
if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
if (eval("typeof("+stringa+"1)=='undefined'"))
eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)")
else
eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)")
else
eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
i=i+1
}
//son.focus()
i=1
combostatus=''
cstatus=stringa.split("_")
while (cstatus!=null) {
combostatus=combostatus+cstatus
i=i+1
}
return combostatus;
}
}
//-->
</script>
<form>
<select name="combo0" id="combo_0" onChange="change(this);" style="width:200px;">
<option value="value1">Select Country</option>
<option value="value2">COUNTRY a</option>
<option value="value3">cOUNTRY b</option>
</select>
<BR><BR>
<select name="combo1" id="combo_1" onChange="change(this)" style="width:200px;">
<option value="value1"> </option>
</select>
<BR><BR>
<select name="combo2" id="combo_2" onChange="change(this);" style="width:200px;">
<option value="value1"> </option>
</select>
<BR><BR>
<select name="combo3" id="combo_3" onChange="change(this);" style="width:200px;">
<option value="value1"> </option>
</select>
</form>