Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/09/2009, 10:30
doylelives
 
Fecha de Ingreso: junio-2008
Ubicación: Capital Federal xD
Mensajes: 1.208
Antigüedad: 16 años, 8 meses
Puntos: 35
Respuesta: porque siempre lee/envia el ultimo bucle

En mi ejemplo si se concatena correctamente!!
envia el id del bucle actual pero no la descripcion del bucle actual sino ultima.
no me gusta pone mucho codigo pero en este caso quizas sea lo mejor para que me entiendan:
(el resto del codigo esta bien, funciona bien)
Código PHP:
for (0oRecordValues.lengthi++) {
        var 
divA document.createElement("div");
        
divA.setAttribute("class","recordResult_container");
        
divA.setAttribute("id","record"+oRecordValues[i].getAttribute("id"));
        
        var 
divB document.createElement("div");
        
divB.setAttribute("class","recordResult_title");
        var 
table1 document.createElement("table");
        var 
tr1 document.createElement("tr");
        
tr1.setAttribute("class","bold");
        var 
description="";
        for (
0arrayTitle.lengthj++) {
            
recordChild oRecordValues[i].getElementsByTagName(arrayTitle[j]);
            var 
td1 document.createElement("td");
            var 
newText1 document.createTextNode(recordChild[0].childNodes[0].nodeValue);
            
td1.appendChild(newText1);
            
tr1.appendChild(td1);
            
table1.appendChild(tr1);
        
separo los campos con un guion
            description
+=recordChild[0].childNodes[0].nodeValue+" - ";
        }
        
        
divA.addEventListener("click",function(event){
        
//this hace referencia a divA
        
id this.id.substring(6);
        
//un ejemplo de description que posee los campos obtenidos en el for de arriba
        //101 - analisis de sangre -
        //ahora quito los ultimos 3 caracteres extras ( - )
        
description description.substring(0,description.length-3);
        
selectionCallback(iddescription);
        }, 
false);
        
        for (
0arrayDescr.lengthj++) {
            
recordChild oRecordValues[i].getElementsByTagName(arrayDescr[j]);
            var 
tr2 document.createElement("tr");
            var 
td1 document.createElement("td");
            var 
newText1 document.createTextNode(recordChild[0].nodeName+":");
            
td1.appendChild(newText1);
            var 
td2 document.createElement("td");
            var 
newText2 document.createTextNode(recordChild[0].childNodes[0].nodeValue);
            
td2.appendChild(newText2);
            
tr2.appendChild(td1);
            
tr2.appendChild(td2);
            
table1.appendChild(tr2);
        }
        
divB.appendChild(table1);
        
divA.appendChild(divB);
        
oFinderResults.appendChild(divA);
    } 
el problema en esta linea, el id siempre es diferente pero la descripcion siempre le envia la del ultimo bucle.
selectionCallback(id, description);
__________________
I am Doyle please insert code.

Última edición por doylelives; 02/09/2009 a las 10:40