Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:20:19+00:00 2026-06-12T05:20:19+00:00

I have the below chunk of code. I’ve debugged through and located the snippet

  • 0

I have the below chunk of code. I’ve debugged through and located the snippet that is causing a long delay in IE6.

Basically the code loops through a document converting it to XML and sending to a PDF. On Ubuntu and Firefox 4 it takes 3 seconds. On IE it can take up to 40 seconds regularly.

/**
* This function builds up the XML to be saved to the DM.
*/
function getXMLToSave(){

var text="<workbook><sheet><name>Adv4New</name>";

//show_props(document.adv4.row10col1, "document.adv4.row10col1");

for(i=1;i<157;i++){
    text = text + "<row number='" + i + "'>";
    for(j=1;j<=7;j++){
        text = text + "<col ";
        //alert(eval('document.adv4.row'+i+'col'+j+'.readonly'));
        try{
            text = text + "number='" + j + "' label='" + eval('document.adv4.row'+i+'col'+j+'.className')+ "'";
        }
        catch (e) {
            text = text + "number='" + j + "' label=''";
        }
        try {
            if(eval('document.adv4.row'+i+'col'+j).readOnly)
            text = text + " type='readonly'";
            else
            text = text + " type=''";
        }
        catch (e) {
            text = text + " type=''";
        }
        try {
            text = text + " color='" + eval('document.adv4.row'+i+'col'+j+'.style.color') + "'";
        }
        catch (e) {
            text = text + " color=''";
        }
        text = text + ">";
        try {
            // don't wrap in a CDATA (like previously), but run cleanNode
            // this fixes html entities
            var content = eval('document.adv4.row'+i+'col'+j+'.value');
            text = text + cleanNode(content);
        }
        catch (e) {
            text = text + "0";
        }
        text = text + "</col>";
    }
    text = text + "</row>";
}
text = text + "</sheet></workbook>";

return text;

}

I believe its the eval function causing the delay in IE6. Is there a neat solution to fix this. Thanks very much

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:20:21+00:00Added an answer on June 12, 2026 at 5:20 am

    It’s likely that it’s all the string concatentation that makes it slow. Each time you add something to the text, it will copy all the previous text into a new string.

    Newer browsers have optimised code for this special case, so for them the impact is less.

    Instead of concatenating strings like this:

    text = text + "something";
    

    use an array instead:

    var text = [];
    

    then add items to the array using the push method:

    text.push("<workbook><sheet><name>Adv4New</name>");
    

    Finally just join the strings together:

    return text.join('');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below snippet of code in which TestClass is extending jPanel which is
I have a very simple chunk of code that is designed to simulate keyboard
I have a code chunck below that is being output with a space in
Update is below code chunks. Original Question: I have an input field that is
I have a chunk of PHP code that I'd like to include on a
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which
I have below code: class Program { static void Main(string[] args) { Task[] tasks
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
Below is the beginning of a chunk of SPIM code: .data a: .space 20

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.