Try wrapping strHTML in one single wrapper DIV before you insert it into the
DOM. I'll bet it will go a lot faster:

    $('div.displayer').html( '<div>' + strHTML + '</div>' );

How's the timing on the for loop? Any browsers where it takes any
significant time? You may speed it up in some browsers by using an array
instead:

    var n = v_foundarray.length;
    var html = new Array( n );
    for ( var k = 0;  k < n;  k++ ) {
        html[k] = '<div>' + v_foundarray[k] + '</div>';

    $('div.displayer').html( '<div>' + html.join('') + '</div>' );

One last thing... Is $('div.displayer') itself taking any significant time?
If it is, you could cache it once, or use an ID instead of a classname.

-Mike

> posting all code would be crazy but here is relevant snippets.
> First the loop I use to iterate ofer an array and write some 
> stuff into a bunch of DIV elements.
> I then want that tho show up someplace on my page. iframe and 
> document.write displays 500 items basically instantly.
> the html() to div element takes about 4 seconds or so in IE7.
> 
>     for ( var k = 0; k < v_foundarray.length; k++ ) {
>          strHTML += '<div>' + v_foundarray[k] + '</div>';
>     }
> //window.ifrm.document.open();
> //window.ifrm.document.write(strHTML);
> //window.ifrm.document.close();
> 
> $('div.displayer').html(strHTML);
> 

Reply via email to