number of rows in a table

S

SmittyBroham

Jack,

Sorry I can't be more explicit, but this will point you in the right
direction. Using the JavaScript DOM model, you can assign the table(s)
you need to count rows for an id (for example, <table name="mytable",
id="table1">). Using DOM, you can directly access the table and count
the number of <td> tags that appear within. Obviously, each <td></td>
set is equivalent to 1 row.

-Mark
 
R

RobG

q2005 said:
Hi, all

How do I get the number of rows in a table?

Pass the id of the table to count the rows of. Get the rows
collection, then its length:

function numRows(t) {
if(document.getElementById) {
alert(document.getElementById(t).rows.length);
} else if (document.all) {
alert(document.all[t].rows.length);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top