Board Logo

Pull data from the existing HTML table
tigra - 9/10/2008 at 07:00 PM

Code:

<script>
var e_table = document.getElementById('myTable'), // <- ID of your table here
e_row, TABLE_CONTENT = [];
// hide the static HTML table
e_table.style.display = 'none';
// skip first row (starting from 1 instead of 0)
for (var r = 1; r < e_table.rows.length; r++) {
var a_row = [], re_tags = /<[^>]*>/g;
e_row = e_table.rows[r];
// skip first column
for (var c = 1; c < e_row.cells.length; c++) {
a_row[a_row.length] = (c == 3
// remove HTML for fourth row
? String(e_row.cells[c].innerHTML).replace(re_tags, '')
: e_row.cells[c].innerHTML
);
}
TABLE_CONTENT[TABLE_CONTENT.length] = a_row;
}
new TTable(TABLE_CAPT, TABLE_CONTENT, TABLE_LOOK);

</script>



TABLE_CAPT must be configured to match the table's columns


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/