function dynamicTable(tableID,fields,fieldStyles,allowRemove,varName) { this.table = document.getElementById(tableID); this.fields = fields; this.fieldStyles = fieldStyles; this.allowRemove = allowRemove; this.numRows = 0; this.varName = varName; this.addRowIndex = 0; this.dtAddRow = dtAddRow; this.dtRemoveRow = dtRemoveRow; this.dtRemoveAll = dtRemoveAll; this.dtCountDynRows = dtCountDynRows; this.dtGetCell = dtGetCell; this.rFields = new Array(); //needed to lookup cell index by field name for(i=0;i" + "" +""; } } function dtRemoveRow(i) { this.table.deleteRow(i); this.numRows = this.table.rows.length - 1; } function dtRemoveAll() { while(this.numRows > 0) { this.table.deleteRow(this.numRows); this.numRows = this.table.rows.length - 1; } } function dtGetCellContent(column, rowIndex) { if(cellindex = this.rFields[column]) { return this.table.rows[rowIndex].cells[cellindex].innerHTML; } } function dtCountDynRows() { return (this.table.rows.length + this.addRowIndex - 1); } function dtGetCell(column, rowIndex) { if(cellindex = this.rFields[column]) { return this.table.rows[rowIndex].cells[cellindex]; } }