Reputation: 369
in my javascript I load up an array based upon the HTML which has already produced. In Firefox this works perfectly, but in Internet Explorer 7 the page hangs for approximately several minutes.
I can't see why it takes so long to do something Firefox has no problem with?
ImageHTMLContainer just acts like a dictionary storing inner html.
var ImageHTMLContainer = [];
addLoadEvent(init);
function init() {
var NumOfRows = parseInt(DID("NumRows").innerHTML);
var NumOfCols = parseInt(DID("NumCols").innerHTML);
var i;
var j;
for (i = 0; i < NumOfRows; i++) {
ImageHTMLContainer["Row" + i.toString()] = DID("Row" + i).innerHTML;
for (j = 0; j < NumOfCols; j++) {
ImageHTMLContainer["Row" + i.toString() + "Col" + j.toString()] = DID("Row" + i + "Col" + j).innerHTML;
}
}
}
Upvotes: 0
Views: 136
Reputation: 26183
ie7's js engine is a lot older and slower than the one in firefox.
You have a loop within a loop that reads innerHTML - don't do that, it is probably the very least efficient way you can do what you are doing.
Have you considered loading your data via xml or json instead of initializing your javascript data via the rendered DOM?
Upvotes: 1