SO 38823238

HTML

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Jumlah Baris Tabel</title>
</head>

<script type="text/javascript">
function cekJum()
{
var jumlah=document.getElementsByClassName("tabellatihan").rows.length;
document.getElementsByClassName("hasil").innerHTML=jumlah;
}
</script>

<body>

<p>

<input type="submit" name="Submit" value="Cek Jumlah" onclick="cekJum()" />

</p>

<p id="hasil">&nbsp;</p>

<table width="100%" border="5" id="tabellatihan">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp; </p>
</body>
</html>