Combo JavaScrip problemas Performance

0 respostas
julianoeustaquio

Bom tenho um combo que e preenchido após resposta de um AJAX, até ai tudo bem, a resposta do Ajax chega e eu monto o combo via JavaScript

function carregaCombo(element, dado){
    var indice =0;
    var option = document.createElement("OPTION");
    var msie = navigator.userAgent.indexOf("MSIE") != -1;


    option.value ="";
    option.text ="- - - - - - - - - - ";
    msie ? element.add(option) : element.add(option, null);
        
    
    if(dado.length > 0){
         while(dado.length > indice){
            option = document.createElement("OPTION");
            option.text = dado[indice].substring(0,dado[indice].lastIndexOf("#"));
            option.value = dado[indice].substring(dado[indice].lastIndexOf("#")+1, dado[indice].length);

            msie ? element.add(option) : element.add(option, null);

            indice++;
         }
    }


}

O problema e que no FireFox o combo fica preenchido com 4 segundos e no Internet Explorer está levando 54 segundos.
Alguem ai tem uma dica???

Criado 12 de março de 2008
Respostas 0
Participantes 1