This works in IE but not Chrome. So something to do with how the browser handles the code. I’m fairly new to all this so apologies for not realizing the solution if it’s simple. I looked around for something similar but couldn’t find it.
function reFillTable(newData)
{
var tbl = document.getElementById("string"); //works
var tblLength = tbl.rows.length; //this works fine
var row = null;
var cell = null;
splitString = newData.split(" ");
var tableIndex = 1;
for (var n = 0; n < tblLength; n++)
{
row = tbl.rows(n); //this breaks in chrome but not IE???????
//code continues but is irrelevant as of now...
}
}
I can get an alert before the “row = tbl.rows(n);” but not after so it’s clearly breaking on this line. What’s the deal here? Also, is there a better way to traverse a table than this method? It was the only thing I found so I’ve been using this.
try using
row = tbl.rows[n];It is the proper way for traversing table, and supported by all browsers