I'm having a few problems .

What I want to do is when the user clicks on a table row, it then enables/disables a checkbox held within that row.

HTML Code:

HTML Code:
<form action="?action=delete" method="post">

	<th>ID</th><th>Forename</th><th>Surname</th><th>Institution</th><th>Membership Type</th><th>Delete</th>


			<td>University of Strathclyde</td>
			<td><input type="checkbox" id="member_ids" name="member_ids[]" value="1" /></td>														


			<td>University of Edinburgh</td>
			<td><input type="checkbox" id="member_ids" name="member_ids[]" value="2" /></td>														


			<td>University of Stirling</td>
			<td><input type="checkbox" id="member_ids" name="member_ids[]" value="3" /></td>														


	<button type="submit" class="confirm" name="submit">Delete Selected Members</button>


function tableRowClickSetUp() {
	var theTrList = document.getElementsByTagName('tr');
	for (var i = 1; i < theTrList.length; i++) {
		var theTr = theTrList.item (i);
		theTr.onclick = function () {				
			var theInputList = this.getElementsByTagName('input');		
			var theInput = theInputList.lastChild;
			if (theInput.checked = true) {
				theInput.checked = false;
			} else {
				theInput.checked = true;

Does anyone know how to do this?

Thanks in advance