FugitivePuppeT
Programmer
Code:
function InputRow() {
this.currentRow;
this.rowCount;
}
InputRow.prototype.newColumn = function (nColInnerHTML) {
var nCol = document.createElement('td');
nCol.innerHTML = nColInnerHTML;
this.currentRow.appendChild(nCol);
}
InputRow.prototype.newRow = function(inputColumns) {
var newTR = document.createElement('tr');
for (var i = 0; i <= inputColumns.length - 1; i++) {
var tdNode = document.createElement('td');
tdNode.setAttribute('align', 'center');
tdNode.innerHTML = "<input type='text' id='" + inputColumns[i] + this.rowCount + "' name='" + inputColumns[i] + this.rowCount + "' class='" + inputColumns[i] + "' />";
newTR.appendChild(tdNode);
}
this.rowCount++;
alert(this.rowCount);
this.currentRow = newTR;
return newTR;
}
The only problem i am having is.. i was using a global _rowcount and of course it worked fine, counting up and such, but it obviously screwed the pooch with more than one instance of this object.
I am trying to use this.rowCount as my counter.
It keeps resetting to 0 every function call.