DelphiFAQ Home Search:
General :: Web publishing :: JavaScript :: Document


Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Obtain the number of rows in a table

Question:

How can I obtain the number of rows in an HTML table using javascript?

Answer:

The following code assumes that your table has the ID 'MyTable'

<script language="JavaScript">
 <!--
 var oRows = document.getElementById('MyTable').getElementsByTagName('tr');
 var iRowCount = oRows.length;
 
 alert('Your table has ' + iRowCount + ' rows.');
 //-->
</script>
 

Generated 12:01:46 on Jul 18, 2018