View Full Version : page stalling in IE6 with dynamic table gen via DOM

10-27-2005, 10:23 AM
hi guys, first post here, wonder if you can help me.

I am getting a table via php fopen() from another website (with permission) writing it to a hidden div on the page so I can access it via the DOM.

My script then picks up the table and then parses it picking out the data from the old cells and creating new textNodes and elements to create a new table free of the other page's formatting.

It works fine in Firefox but in IE6 and safari the page stalls after displaying the banner and main text container.

page is http://www.loughboroughhockey.co.uk/leagues

the script is

function getLeagueTable(){
if(!document.getElementById('leagueFrame')) {return false;}
if(!document.createElement) return false;
if(!document.createTextNode) return false;
var leagueFrame = document.getElementById('leagueFrame');
var outputDiv = document.getElementById('output');

var tables = leagueFrame.getElementsByTagName('table');
var leagueTable = tables[0];

var newLeagueTable = document.createElement('table');
var newTableBody = document.createElement('tbody');

var oldRows = leagueTable.getElementsByTagName('tr');

//ignore first cell in each row because it is empty
for (i = 1; i < oldRows.length ; i++){
var cells = oldRows[i].getElementsByTagName('td');

var newRow = document.createElement('tr');

//deal with title cell because the text we want is within an 'a'
var aContents = cells[1].getElementsByTagName('a');
var teamName = aContents[0].firstChild.nodeValue;

var titleCell = document.createElement('td');
var newTextNode = document.createTextNode(teamName);


//now deal with rest of cells
for (j = 2; j < cells.length ; j++){
//get value from old cell
var oldText = cells[j].firstChild.nodeValue;

var currentCell = document.createElement('td');
var textNode = document.createTextNode(oldText);






please help!!


10-27-2005, 12:05 PM
haha im such a dumbass sometimes. I tracked down the problem thanks to microsoft's dev tools (wonder where they got the idea) and its dom inspector. I had chopped the last ">" off the closing table tag. Firefox was smart enough to put it back in and carry on as normal and the source looked fine, it was only finding some errors in the DOM in IE that let me track down the problem. Nothing to do with the JS in the end.