Hi guys,

I am not sure if my first post is publish because I did not see it on the list.

Here is my issue..

I have an HTML that has two projects (it can be change because it is dynamic). Now I would like if I tick the radio button on the heading it will tick all the person that belongs to that project.

Code:
		<table class="table table-condensed table-hover">
			<thead>
				<tr>
					<th>Project A</th>
					<th style="text-align:center;">
						<a href="javascript:selectAllComposite(2);">2</a>
					</th>
					<th style="text-align:center;">
						<a href="javascript:selectAllComposite(1);">1</a>
					</th>
					<th style="text-align:center;">exclude</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>Project A -- Sample 1</td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_128_87" id="ass_ID_128" value="2" /></td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_128_87" id="ass_ID_128" value="1" /></td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_128_87" id="ass_ID_128" value="" checked /></td>
				</tr>
			</tbody>
			<tbody>
				<tr>
					<td>Project A -- Sample 2</td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_74_87" id="ass_ID_74" value="2" /></td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_74_87" id="ass_ID_74" value="1" /></td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_74_87" id="ass_ID_74" value="" checked /></td>
				</tr>
			</tbody>
			
			
			
			<thead>
				<tr>
					<th>Project B</th>
					<th style="text-align:center;">
						<a href="javascript:selectAllComposite(2);">2</a>
					</th>
					<th style="text-align:center;">
						<a href="javascript:selectAllComposite(1);">1</a>
					</th>
					<th style="text-align:center;">exclude</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>Project B -- Sample 1</td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_601_121" id="ass_ID_601" value="2" /></td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_601_121" id="ass_ID_601" value="1" /></td>
					<td style="text-align:center;" width="5%" nowrap><input type="radio" name="ass_ID_601_121" id="ass_ID_601" value="" checked /></td>
				</tr>
			</tbody>
		<table>

Here is my current javascript code but it would tick ALL radio button in the form, which is wrong:

PHP Code:

       
function selectAllComposite(groupNum)
        {
            var 
frm document.getElementById("frmMain");
           
            for (var 
0frm.elements.lengthx++)
            {
                if (
frm.elements[x].type == "radio" && frm.elements[x].value == groupNum)
                    
frm.elements[x].checked true;
            }
        } 

I need only ticking persons that belongs to that project.