| |

VerySource

 Forgot password?
 Register
Search
View: 8|Reply: 2

How to get the number of rows in a table?

[Copy link]

1

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-3-11 23:00:01
| Show all posts |Read mode
Ask everyone, I use object.innerHTML = '<table>' + '<tr>' + '<td>' + '</ td>' + '</ tr>' + '<tr>' + '<td > '+' </ td> '+' </ tr> '
Created a table with 2 rows and 1 column
How do I get the number of rows of a table in object.innerHTML?
There aren't many points, I'll fill it up when I have it!
Reply

Use magic Report

0

Threads

52

Posts

38

Credits

Newbie

Rank: 1

Credits
38

 China

Post time: 2020-6-5 14:30:02
| Show all posts
tabletest.rows.length
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-6-6 15:45:01
| Show all posts
<script>
function doFunction(objId){
alert(document.getElementById(objId).getElementsByTagName("tr").length);
}
</script>
<table id="aa" onclick="doFunction('aa')" border="1">
<tr>
<td>fdsaf
</td>
</tr>
<tr>
<td>fdsaf
</td>
</tr>

</table>
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list