Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/10/2005, 05:55
ratamaster
 
Fecha de Ingreso: octubre-2004
Ubicación: En algún lugar de la República Oriental del Uruguay
Mensajes: 366
Antigüedad: 19 años, 7 meses
Puntos: 0
Hola de nuevo, le hice unas mejoras, ahora el herror está en que cuando elijo una provincia en IE, salta un error:

Código PHP:
<html>
<
head>
<
title></title>
<
script type="text/javascript">


var 
sum=0
function 
selectAsociado(){
sum++;
var 
province1 
province1 
document.form1.province1[document.form1.province1.selectedIndex].value
    
if (province1 != 0) {
        
mis_subsecc=eval("secc_sub" province1)
        
num_seccisub mis_subsecc.length
        document
.form1.city1.length num_seccisub
        
        mis_subseccVls
=eval("secc_subVls" province1)
        
num_seccisubVls mis_subseccVls.length
        document
.form1.city1.length num_seccisubVls
    
        
for(i=0;i<num_seccisub;i++){
            
document.form1.city1.options[i].value=mis_subseccVls[i
            
document.form1.city1.options[i].text=mis_subsecc[i]
        }
    }else{
    
document.form1.city1.length 1
    document
.form1.city1.options[0].value "0"
    
document.form1.city1.options[0].text "-"
    
}
    
document.form1.city1.options[0].selected true
}



//textos de las ciudades
var secc_sub1= new Array('---''Villa Carlos Paz''Cosquin''Mina Clavero''La Falda')
var 
secc_sub2= new Array('---''Chacras de Coria''San Rafael''Malargue')

//valores de las ciudades
var secc_subVls1= new Array('0''1''2''3''4')
var 
secc_subVls2= new Array('0''5''6''7')



Num=0;
function 
Agregar(){
        
obj=document.getElementById('tabla');
        
f=document.getElementById('fila');
        
Num++;
                
        
elTr=document.createElement('tr');
        
elTr.id='valor'+Num;
        
elTd=document.createElement('td');
        
elTd.innerHTML='Provincia:';
        
elTr.appendChild(elTd);
        
elTd=document.createElement('td');
        
        
selectf=document.createElement("select"); // creo el select
        
selectf.onchange=selectAsociado// la asigno la función
        
selectf.setAttribute("name","province" Num); // nombre del select
        
        
        
Opt1=document.createElement("option"); // creo el option
        
Opt1.setAttribute("id","province" Num); // le doy id al option
        
Opt1.setAttribute("value","1"); // le asigno valor al option
        
Opt1.appendChild(document.createTextNode("Cordoba")); // la asigno texto al option
        
selectf.appendChild(Opt1); // asigno al opion al select
        
        
Opt2=document.createElement("option"); // creo el option
        
Opt2.setAttribute("id","province" Num); // le doy id al option
        
Opt2.setAttribute("value","2"); // le asigno valor al option
        
Opt2.appendChild(document.createTextNode("Mendoza")); // la asigno texto al option
        
selectf.appendChild(Opt2); // asigno al opion al select   
            
        
        
elTr1=document.createElement('tr');
        
elTr1.id='valor'+Num;
        
elTd1=document.createElement('td');
        
elTd1.innerHTML='Ciudad:';
        
elTr1.appendChild(elTd1);
        
elTd1=document.createElement('td');

        
selectf1=document.createElement('select');
        
selectf1.name='city'+Num;
        
        
// añadir boton para borrar
        
bot_delete=document.createElement('input');
        
bot_delete.type='button';
        
bot_delete.value='borrar';
        
bot_delete.setAttribute('borrar','valor'+Num);
        
bot_delete.onclick = function() {
          
obj=document.getElementById('tabla');
          
obj.removeChild(document.getElementById(this.getAttribute('borrar')));
          
obj=document.getElementById('tabla');
          
obj.removeChild(document.getElementById(this.getAttribute('borrar')));
        
Num--;
        }
        
        
elTd.appendChild(selectf);
        
elTd.appendChild(bot_delete);

        
elTr.appendChild(elTd);
        
obj.insertBefore(elTr,f)
        
        
elTd1.appendChild(selectf1);
        
elTd1.appendChild(bot_delete);

        
elTr1.appendChild(elTd1);
        
obj.insertBefore(elTr1,f)
        

        
        return 
Num;
}

</script>

</head>
<body>

<form  method="POST" name="form1">

                                        
<table border="0" cellpadding="0" cellspacing="0" >
    <tbody id="tabla" border="1">              
         <tr id="fila">

         <td>&nbsp;</td>  
        </tr>
</table>
<input type="button" name="duplicate" value="Ingresar otra localidad" onClick="Agregar()"></td>   

</form>
</body>
</html> 

Alguien sabe porque salta este error??
__________________
ratamaster