Ciao a tutti!


ho un problema con un codice javascript che mi genera delle select dipendentitra di loro...

il codice funziona perfettamente il problema che mi sta facnedo impazzire è che in Firefox, una volta che seleziono delle option dalle mie select e passo i valori delle value nella pagina successiva funziona in modo corretto...

mentre in Explorer 8 questo non avviene, ossia le select dipendenti vanno bene...solo che quando devo ricavare la value delle option queste mi risultano vuote...

se volete questo è il codice che genera le mie select:

<script language="JavaScript" type="text/javascript">
<!--

// This script supports an unlimited number of linked combo boxed
// Their id must be "combo_0", "combo_1", "combo_2" etc.
// Here you have to put the data that will fill the combo boxes
// ie. data_2_1 will be the first option in the second combo box
// when the first combo box has the second option selected

// first combo box

data_1 = new Option("Italia");
data_2 = new Option("Svizzera");

// second combo box

data_1_1 = new Option("Lombardia");


data_1_1_1 = new Option("Como");



data_1_1_2 = new Option("Milano");


data_1_2 = new Option("Piemonte");


data_1_2_1 = new Option("Torino");


data_1_3 = new Option("Veneto");

data_1_4 = new Option("Trentino");

data_1_5 = new Option("Toscana");

data_2_1 = new Option("Ticino");


// other parameters

displaywhenempty="-Seleziona-"
valuewhenempty=-1

displaywhennotempty="-Seleziona-"
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_"+f ollowing+"\"))!='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[i]!=null) {
combostatus=combostatus+cstatus[i]
i=i+1
}
return combostatus;
}
}

//-->
</script>

<form name="villa" method="post" action="2.asp" >

PAESI:
<select name="combo0" id="combo_0" onChange="change(this);" style="width:200px;">
<option value="value1">-Seleziona Paese-</option>
<option value="Italia">Italia</option>
<option value="Svizzera">Svizzera</option>

</select>
REGIONI:
<select name="combo1" id="combo_1" onchange="change(this);" style="width:200px;" >
<option value="value1">-Seleziona-</option>
</select>
CITTA':
<select name="combo2" id="combo_2" onChange="change(this);" style="width:200px;" >
<option value="value1">-Seleziona-</option>
</select>

<input type="submit" name="vai" value="invia" />
</form>



spero che qualcuno possa aiutarmi..

grazie.

Ciao!