DelphiFAQ Home Search:

Obtain the number of rows in a table

 

comments39 comments. Current rating: 5 stars (9 votes). Leave comments and/ or rate it.

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>

Content-type: text/html

Comments:

You are on page 2 of 3, other pages: 1 [2] 3
2009-08-03, 23:06:42
anonymous from Oman  
rating
thanx
2009-09-21, 08:05:31
shaktysingh@hotmail.com from New Delhi, India  
Thanks a lot.....it really helped....
2009-10-08, 03:22:18
anonymous from Hong Kong  
thank you very much~~
2009-11-22, 20:45:18
Dmont from Mexico  
Tanks!!!
2009-11-22, 20:47:01
Dmont from Mexico  
Thanks, story for the last msg, jejeje i forget the h!! ejeje
2009-12-13, 03:45:44
anonymous from United States  
its really wonderful, thanks a lot

kamlesh
2010-03-03, 08:11:45
anonymous from Germany  
not working
2010-05-18, 06:31:55
anonymous from Bridgewater, United States  
rating
JUST GREAT!!
2011-11-03, 11:12:56
anonymous  



Keywords:
2012-07-18, 07:30:14
anonymous from India  
thanx,,
2012-07-18, 07:48:31
anonymous from Ahmedabad, India  
nice job dude
2014-07-13, 07:35:16
anonymous from Malaysia  
Rahim Suboh
Bank Account 104068242480
2014-07-13, 07:35:17
anonymous from Malaysia  
Rahim Suboh
Bank Account 104068242480
2014-07-13, 07:36:58
anonymous from Malaysia  
Rahim Suboh
Bank Account 104068242480
2014-07-13, 07:38:35
anonymous from Malaysia  
Rahim Suboh
Bank Account 104068242480
You are on page 2 of 3, other pages: 1 [2] 3

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: