I have a table in HTML:
<table id="cust">
<tr>
<th>UserName</th>
<th>Password</th>
</tr>
<script type="text/javascript">addRows();</script>
</table>
and I have function in JS that insert Rows to this table. for example:
function addRows() {
// Get a reference to the table
var table = document.getElementById("cust");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell0 = row.insertCell(0);
var cell1 = row.insertCell(1);
cell0.innerHTML = "ilan";
cell1.innerHTML = "11111";
}
but I want that every row that insert to the table, will be with onClick event like that:
<tr onclick="window.document.location='Accounts.html';">
how can I do that?
thank you !!