<script type="text/javascript"> function selectRow(row) { var firstInput = row.getElementsByTagName('input')[0]; firstInput.checked = !firstInput.checked; } </script>
...
<tbody> <tr onclick="selectRow(this)"><td width="20px"><input type="checkbox" id="chk1" name="chk1/"></td><td>1</td><td>2011-04-21 22:04:56</td><td>action</td></tr> <tr onclick="selectRow(this)"><td width="20px"><input type="checkbox" id="chk2" name="chk2/"></td><td>2</td><td>2011-04-21 22:04:56</td><td>action</td></tr> </tbody>
Note: you also have collisions by identifiers. Your identifiers must be unique.
Here is an alternative with software binding:
document.querySelector("table").addEventListener("click", ({target}) => {
<table> <tbody> <tr> <td> <input type="checkbox" id="chk1" name="chk1" /> </td> <td>1</td> <td>2011-04-21 22:04:56</td> <td>action</td> </tr> <tr> <td> <input type="checkbox" id="chk2" name="chk2" /> </td> <td>2</td> <td>2011-04-21 22:04:56</td> <td>action</td> </tr> <tr> <td> <input type="checkbox" id="chk2" name="chk3" /> </td> <td>2</td> <td>2011-04-21 25:30:16</td> <td>action</td> </tr> </tbody> </table>
canon source share