IE slows down very much with appendChild

Posted on 2008-10-21
Medium Priority
Last Modified: 2013-12-08
Below is shown the code that is causing problems. It is related to other parts of code, together which they create a list that is to be added to current page to the span-tag with id "lista".
With Fireworks, everyting works OK and with reasonable good speed. However, with Internet explorer (7 and I guess also earlier versions) it will run smoothly and also with reasonable speed until the line
is reached (tested with the aler above, and also by commenting that line). However, runnign that line causes the page to load v e r y slowly and when refreshed or reloaded after visiting other parts of site, the mentioned error dialog is shown (script slowing IE down).
Is there some other way to put the code in http.responseText; to the existing page? That http.resonseText holds long list in table, inside a div -tag.

function lataaListat()
			if (http.readyState == 4){
				if (http.status == 200)
					if (http.responseText)
						var newdiv = document.createElement("div");
						newdiv.innerHTML = http.responseText;
						var container = document.getElementById("lista");
						alert ("valmis");
						alert("http.responseXML ei skulaa");
				else if(http.status == 404) {
					alert("Requested file not found");
				else {
					alert("Error has occurred with status code:"+http.status);
		catch (err)
			alert("Haku ei onnistunut");

Open in new window

Question by:Seppoo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Author Comment

ID: 22771603
I don't know if these findings help further, but:
I figured out that all goes fine if I change what I am appending there. If I append:the code below, all goes fine ( I actually do abbed a little more, but since that causes no problem and it would just take space here I have excluded that. However that excluded part contains table inside of form, which would be appended just before this div-tag).

However, if I append lot of table rows instead of these 2 testlines here, the problems appear.

Moreover, I realized that refreshing the IE did not sho me the immedeate changes I had made while testin, I had to close- reopen whole IE to see the results.
Also, it seemed that the first time I go to the page where this long list loads up, it is OK, However if I go to some other page on same site and then pack there again (in the link "Tuoteluettelo), I get the error of script slowing IE down.
All these act differently in FF: I can reload the page seeing changes without closing FF. And I can navigate freely and come back without any lack of speed.
Therefore, it seems that IE somehow does keep the script running and cant stop it, when it has many lines. Anyway, this all seems odd behaviour..

The link to the site and problem page is here:

<div style="align:center; height:400px; overflow:auto;">

Open in new window

LVL 75

Accepted Solution

Michel Plungjan earned 1500 total points
ID: 22773938
Did you try to have an empty div already in the document and just do

if (http.responseText) {
  document.getElementById('existingDiv').innerHTML = http.responseText;



Author Closing Comment

ID: 31508349
I am not sure how I managed to make things work actually, it's been a while :) I just forgot this question open, so this is mainly just closing it - and you got the points for 2 reasons: I think that your solution was somewhat similar that I ended up using, and then, your answer was the only one :) Thanks!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question