hola, tengo un problema
estoy haciendo un check donde selecciona el pais, luego el departamento y luego la ciudad, si alguien me colabora este es el codigo.
// first combo box
data_1 = new Option("COLOMBIA", "$");
data_2 = new Option("2", "$$");
// second combo box
data_1_1 = new Option("Amazonas", "-");
data_1_2 = new Option("Antioquia", "-");
data_1_3 = new Option("Arauca", "--");
data_1_26 = new Option("Tolima", "--");
data_1_27 = new Option("Valle", "--");
data_1_28 = new Option("Vaupes", "--");
data_1_29 = new Option("Vichada", "--");
// third combo box
data_1_1_1 = new Option("Leticia", "*");
data_1_1_2 = new Option("Otro", "*");
data_1_2_1 = new Option("Medellin", "*");
data_1_4_4 = new Option("Carmen de Bolivar", "*");
data_1_4_5 = new Option("Cicuco", "*");
data_1_4_6 = new Option("Clemencia", "*");
data_1_4_7 = new Option("Magangue", "*");
data_1_4_8 = new Option("Mompox", "*");
data_1_4_9 = new Option("San Jacinto", "*");
data_1_4_10 = new Option("Soplaviento", "*");
data_1_4_11 = new Option("Otro", "*");
data_1_5_1 = new Option("Tunja", "*");
data_1_5_2 = new Option("Duitama", "*");
data_1_5_3 = new Option("Paipa", "*");
data_1_8_7 = new Option("Otro", "*");
data_1_9_1 = new Option("Valledupar", "*");
data_1_9_7 = new Option("Astrea", "*");
data_1_9_8 = new Option("Otro", "*");
data_1_10_1 = new Option("Quibdo", "*");
data_1_10_2 = new Option("Atrato", "*");
data_1_10_3= new Option("Riosucio", "*");
data_1_10_4= new Option("Condoto", "*");
data_1_10_5 = new Option("Otro", "*");
data_1_11_1= new Option("Monteria", "*");
data_1_11_2= new Option("Valencia", "*");
data_1_11_3= new Option("Ayapel", "*");
data_1_11_4= new Option("Buenavista", "*");
data_1_11_5= new Option("San Pelayo", "*");
data_1_11_6= new Option("Otro", "*");
data_1_12_1= new Option("Bogota D.C.", "*");
data_1_12_2= new Option("Anolaima", "*");
data_1_12_3= new Option("Anapioma", "*");
data_1_12_4= new Option("Apulo", "*");
data_1_12_5= new Option("Cabrera", "*");
data_1_12_6= new Option("Cachipay", "*");
data_1_12_7= new Option("Cajica", "*");
data_1_12_8= new Option("Caqueza", "*");
data_1_12_9= new Option("Chia", "*");
data_1_12_10= new Option("Cota", "*");
data_1_12_11= new Option("Facatativa", "*");
data_1_12_12= new Option("Funza", "*");
data_1_12_13= new Option("Fusagasuga", "*");
data_1_12_14= new Option("Gacheta", "*");
data_1_12_15= new Option("Girardot", "*");
data_1_12_16= new Option("Guaduas", "*");
data_1_12_17= new Option("Guatavita", "*");
data_1_12_18= new Option("La Calera", "*");
data_1_12_19= new Option("La Mesa", "*");
data_1_12_20= new Option("Madrid", "*");
data_1_12_21= new Option("Mosquera", "*");
data_1_12_22= new Option("Pacho", "*");
data_1_12_23= new Option("Sibate", "*");
data_1_12_24= new Option("Silvania", "*");
data_1_12_25= new Option("Soacha", "*");
data_1_12_26= new Option("Sopo", "*");
data_1_12_27= new Option("Villeta", "*");
data_1_12_28= new Option("Zipaquira", "*");
data_1_12_29= new Option("Otro", "*");
data_1_13_1= new Option("Irinida", "*");
data_1_13_2= new Option("Morichal", "*");
data_1_13_3= new Option("Maripana", "*");
data_1_13_4= new Option("Otro", "*");
data_1_14_1= new Option("San Jose de guaviare", "*");
data_1_14_2= new Option("Calamar", "*");
data_1_14_3= new Option("Miraflores", "*");
data_1_14_4= new Option("Otro", "*");
data_1_15_1= new Option("Neiva", "*");
data_1_15_2= new Option("Pitalito", "*");
data_1_15_3= new Option("Garzon", "*");
data_1_15_4= new Option("La Plata", "*");
data_1_15_5= new Option("Campoalegre", "*");
data_1_15_6= new Option("Palermo", "*");
data_1_21_3 = new Option("Buenavista", "*");
data_1_21_4 = new Option("La Tebaida", "*");
data_1_21_5 = new Option("Circasia", "*");
data_1_21_6 = new Option("Quimbaya", "*");
data_1_21_7 = new Option("Finlandia", "*");
data_1_22_1 = new Option("Pereira", "*");
data_1_22_2 = new Option("Dosquebradas", "*");
data_1_22_3 = new Option("Marsella", "*");
data_1_22_4 = new Option("Santa Rosa", "*");
data_1_22_5 = new Option("Virginia", "*");
data_1_22_6 = new Option("Otro", "*");
data_1_23_1 = new Option("San Andres", "*");
data_1_23_2 = new Option("Providencia", "*");
data_1_23_3 = new Option("Otro", "*");
data_1_24_1 = new Option("Bucaramanga", "*");
data_1_24_2 = new Option("Gambita", "*");
data_1_24_3 = new Option("Velez", "*");
data_1_24_4 = new Option("Matanza", "*");
data_1_24_5 = new Option("San Gil", "*");
data_1_24_6 = new Option("Otro", "*");
data_1_25_1 = new Option("Sincelejo", "*");
data_1_25_2 = new Option("Ricaurte", "*");
data_1_25_3 = new Option("Corozal", "*");
data_1_25_4 = new Option("Ovejas", "*");
data_1_25_5 = new Option("Toluviejo", "*");
data_1_25_6 = new Option("Tolu", "*");
data_1_25_7 = new Option("Coveñas", "*");
data_1_25_8 = new Option("Otro", "*");
data_1_26_1 = new Option("Ibague", "*");
data_1_26_2 = new Option("Espinal", "*");
data_1_26_3 = new Option("Guamo", "*");
data_1_26_4 = new Option("Honda", "*");
data_1_26_5 = new Option("Mariquita", "*");
data_1_26_6 = new Option("Saldaña", "*");
data_1_26_7 = new Option("Natagaima", "*");
data_1_26_8 = new Option("Prado", "*");
data_1_26_9 = new Option("Melgar", "*");
data_1_26_10 = new Option("Otro", "*");
data_1_27_1 = new Option("Cali", "*");
data_1_27_2 = new Option("Cartago", "*");
data_1_27_3 = new Option("La Victoria", "*");
data_1_27_4 = new Option("La union", "*");
data_1_27_5 = new Option("Buga", "*");
data_1_27_6 = new Option("El Cerrito", "*");
data_1_27_7= new Option("Tulua", "*");
data_1_27_8 = new Option("Buenaventura", "*");
data_1_27_9= new Option("Sevilla", "*");
data_1_27_10= new Option("Caicedonia", "*");
data_1_27_11= new Option("Palmira", "*");
data_1_27_12= new Option("Yumbo", "*");
data_1_27_13= new Option("Jamundi", "*");
data_1_27_14= new Option("Otro", "*");
data_1_28_1= new Option("Mitu", "*");
data_1_28_2= new Option("Taraira", "*");
data_1_28_3= new Option("Buenos Aires", "*");
data_1_28_4= new Option("Otro", "*");
data_1_29_1= new Option("Puerto Carreño", "*");
data_1_29_2= new Option("La Primavera", "*");
data_1_29_3= new Option("Santa Rosalia", "*");
data_1_29_4= new Option("Otro", "*");
// fourth combo box
data_2_2_1_1 = new Option("2211","%")
data_2_2_1_2 = new Option("2212","%%")
// other parameters
displaywhenempty="-empty-"
valuewhenempty=-1
displaywhennotempty="-select-"
valuewhennotempty=0
function change(currentbox)
{
var numb = currentbox.id.split("_");
var currentbox = numb[1];
var i=parseInt(currentbox)+1;
// I empty all combo boxes following the current one
var _t=eval("typeof(document.getElementById('combo_"+i +"'))!='undefined'");
while (_t && document.getElementById("combo_"+i)!=null)
{
var son = document.getElementById("combo_"+i);
// I empty all options except the first (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
var stringa='data';
i=0;
_t=eval("typeof(document.getElementById('combo_"+i +"'))!='undefined'");
while (_t && 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)
var following=parseInt(currentbox)+1;
_t=eval("typeof(document.getElementById('combo_"+f ollowing+"'))!='undefined'");
if (_t && 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++;
}
//son.focus();
i=1;
combostatus='';
cstatus=stringa.split("_");
while (cstatus[i]!=null)
{
combostatus=combostatus+cstatus[i];
i=i+1;
}
return combostatus;
}
}
</script>
<td height="38" colspan="2"><p class="Estilo4">Pais:</p>
</td>
<td colspan="4"> <span class="text11">
<select name="combo_0" id="combo_0" onChange="change(this);"
style="width:200px;">
<option >-select-</option>
<option >COLOMBIA</option>
<option >OTRO</option>
</select>
<BR><BR>
</span></td>
</tr>
<tr>
<td height="36" colspan="2"><p class="Estilo4">Departamento:</p> </td>
<td colspan="4"><span class="text11">
<select name="combo_1" id="combo_1" onChange="change(this);"
style="width:200px;">
<option > </option>
</select>
<BR><BR>
</span></td>
</tr>
<tr>
<td height="36" colspan="2"><p class="Estilo4">Ciudad:</p>
</td>
<td colspan="4"><span class="text11">
<select name="combo_2" id="combo_2" onChange="change(this);"
style="width:200px;">
<option value="value1"> </option>
</select>
<BR><BR>
</span></td>
me esta almacenando bien pais, pero en departamento me almacena -- y en ciudad *, no se que pueda ser gracias