I am kind of a newbie, so I am not sure where to look for my mistake. I am want to count all rows of a certain table, but I need to have the number above/inside the table itself. However, I only get the number of rows above the point where I call the function, but I need the number of rows of the entire table.
(...)
<script type="text/javascript">
function countRows()
{
rowsCount = document.getElementById("list").rows.length;
return rowsCount;
}
</script>
<body>
<table id="list">
<tr><td>
There are
<script type="text/javascript"> document.write(countRows()) </script>
rows here. // Returns "1"
</td></tr>
<tr><td>(Stuff goes here)</td></tr>
<tr><td>(Stuff goes here)</td></tr> // script would return "3" here.
<tr><td>(Stuff goes here)</td></tr>
<tr><td>(Stuff goes here)</td></tr>
(...)
No jQuery here! I know it is nice, but I can't use it in this case.