none
javascript String concate fails RRS feed

  • Question

  • In below javscript code snippet, the string concate not works in bold statement, when very long string applys.

    but it works in all other browsers opera, firefox, safari, google chrome.

    only fails in IE.

    test page link:

     http://tester.onlinesitecreator.net/ie/index_l.html

    javscript code snippet:

    ........................

     for(i=0;i<arr2.length;i++)      
     {                                                 
         if(arr2[i])       
         {
          var txt= arr[arr2[i]];
          txt = bf.decrypt(txt);
          arr[arr2[i]]=txt.toString();
          txt=null;
         }
    }    
    bf.destructor();
    bf=null;
    //CollectGarbage();              

    var page_content1="";
    var page_content2="";
    var page_content3="";
    var txt="";

     for(i=0;i<arr2.length;i++)      
     {                                                 
         if(arr2[i])       
         {               
              txt= arr[arr2[i]];   
             try              
             {   
                 var dstart="<!--"+arr2[i]+"-s-->";  
                 var estart="<!--"+arr2[i]+"-e-->";  
                  var buf = new StringBuffer();

     

                 page_content1=page_content.substring(0,page_content.indexOf(dstart));
                  buf.append(page_content1);


                      buf.append(txt.toString());


                    
                     var end_start=page_content.indexOf(estart);
    var end_len=page_content.length;

                     buf.append(page_content.substring(end_start, end_len));

                 page_content=buf.toString();
                 page_content2=null;                     
                
                 page_content3=null;
                 buf=null;
                                 txt=null;
                    arr[arr2[i]]=null;
                   CollectGarbage();

            }                  
             catch(exp)            
             {                            
                alert(exp);
             } 
         }                    
         encry=true;  
     }                             
     if(encry)         
     {    
     var prv=0; 
     document.write(page_content);
     }

    .................

    function StringBuffer() {
       this.buffer = [];
     }

     StringBuffer.prototype.append = function append(string) {
       this.buffer.push(string);
       return this;
     };

     StringBuffer.prototype.toString = function toString() {
       return this.buffer.join("");
     };

    Wednesday, May 26, 2010 11:58 AM

All replies