function DomTable(parent) { this.table = document.createElement("table"); parent.appendChild(this.table); this.style = this.table.style; var row_index = 0; var last_row = null; this.AddRow = function() { last_row = this.table.insertRow(row_index++); } this.AddCell = function() { if (last_row == null) return false; var col = document.createElement("td"); last_row.appendChild(col); return col; } }