Jump to content

DallasSteve

Members
  • Posts

    2
  • Joined

  • Last visited

DallasSteve's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. We debugged client-side in developer tools and cells.length is undefined from the start of the loop.
  2. function AddNewRow() { miNewRow = miNewRow + 1; var sRowID = "x" + miNewRow; var oMainTable = document.getElementById("MainTable"); var oTemplateRow = document.getElementById("TemplateRow"); var oNewRow = oTemplateRow.cloneNode(true); oNewRow.id = ""; oNewRow.className = ""; oNewRow = oMainTable.appendChild(oNewRow); for (var iCell = 0; iCell < oNewRow.cells.length; iCell++) { var oNewCell = oNewRow.cells[iCell]; // do something } } [Why does this forum force all code boxes to the top of the question? I've tried 3 times to insert a message at the top, press enter to leave blank lines, move to the bottom of the page, press the code icon, enter my code, press OK, then the code box always appears at the top of the question. It appears that W3Schools doesn't know how to write javascript. Very unprofessional.] OK, I have the code above which adds a new row to a table based on a template row that is hidden on the page. I clone the hidden row, I set the className of the new row to "" so it won't be hidden, and the row appears just like I want - on my machine. On one of our store's machines we click the Add New Row button and nothing happens. Both machines are running Windows 7 and IE 11. We debugged the failing machine and when the code reaches the for loop the oNewRow.cells.length property is undefined. This is odd because the oNewRow variable shows to contain an HtmlTableRow and the cells property contains a cell collection. Does anyone know why cell length is undefined on some machines and not on others?
×
×
  • Create New...