ukrbend said:
Is there a way to do a client side query (perhaps using a scripting
language) that allows you to query info about an html table that was
constructed on the server side via ASP? So for instance how many rows
and columns the table has.
<table id="foo" border="1">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>Red</td>
<td>Blue</td>
<td>Green</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</table>
<script type="text/javascript">
// grab our table and its rows.
var tabl = document.getElementById("foo");
var rows = tabl.getElementsByTagName("TR");
// count the number of rows
var number_of_rows = rows.length;
// columns is more tricky as each row may contain a
// different number of cells!
var number_of_cols = 0;
for (var i=0; rows
; i++)
{
var n = rows.getElementsByTagName("TD").length;
if (n > number_of_cols) number_of_cols = n;
}
// report our results
window.alert("foo has " + number_of_rows + " rows " +
"and " + number_of_cols + " cols.");
</script>