By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,231 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

get last row of a table

chathura86
100+
P: 227
hi

i want to get the last row of a table
but this table has another table in each cell so

Expand|Select|Wrap|Line Numbers
  1. var rows = table.getElementsByTagName('tr');
  2. var lastrow = rows[rows.length - 1];
  3.  
returns the last row in a child table not he parent table
is there a way to get the last row of the parent table

and i do not worry about the cross browser compatibility
i use only Firefox

Thank you

regards
chathura bamunusinghe
Oct 13 '08 #1
Share this Question
Share on Google+
3 Replies


RamananKalirajan
100+
P: 607
Hi instead of using 'tr' just have a id to the table with that u can easily get the last row of the table.

ex:

[HTML] var oTable = document.getElementById('myTable');
var lastRow = oTable.rows.length; //It will return the last Index of the row[/HTML]

If any more doubts post it in the forum.

Regards
Ramanan Kalirajan
Oct 13 '08 #2

chathura86
100+
P: 227
It really helps me

Thanks a lot

regards

chathura bamunusinghe
Oct 16 '08 #3

RamananKalirajan
100+
P: 607
It really helps me

Thanks a lot

regards

chathura bamunusinghe
No Probs. Keep Moving Forward. if u have any problem post it on the forum, I will try to help u out.

Regards
Ramanan Kalirajan
Oct 16 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.