so here's a simplified version of my javascript function:
var rowCount = 0;
function addIndustryContact() {
var elTableBody = document.getElementById('myTableBody');
var existingRow = elTableBody.firstChild;
var firstRow = document.createElement('tr');
var rowID = 'foo1_' + rowCount;
firstRow.setAttribute('id', rowID);
firstRow.innerHTML = '<td colspan="2" align="right" class="tableDark text4 gray">New Row Here Biotch</td>';
elTableBody.insertBefore(firstRow, existingRow);
var secondRow = document.createElement('tr');
rowID = 'foo2_' + rowCount;
secondRow.setAttribute('id', rowID);
secondRow.innerHTML = '<td class="someClass">cell one</td><td class="someOtherClass>cell two</td>';
elTableBody.insertBefore(secondRow, existingRow);
rowCount++;
}
The function will stick in the table rows HOWEVER the second row added doesn't show two cells in separate columns...it seems to add that second <td> as a third row rather than the 2nd cell in the 2nd row. Also, none of the classes I am specifying are showing up...everything is just plain white. The font family in these cells seems to be inherited from the page css, but the new cells don't have any of the colors or styling they should.
Am I missing something about DOM here? Is the problem my use of innerHTML rather than painstakingly adding each new table cell using DOM?
Any help would be much appreciated.