Newbie Question re setting a value of an item in an array

Hi

I have 2 arrays on my form which using php I auto-populate.
<td><input class=‘checkbox’ type=‘checkbox’ name=‘Selected1’ value=‘$sSelected1[$iCount]’ onClick=‘javascript:iWhichCheckboxChecked()’</td>"
<td><input class=‘quantity-readonly’ type=‘text’ name=‘Quantity1’ value=‘$sQuantity1[$iCount]’</td>

What I’m trying to do (and not well) is to find out which checkbox the user just clicked. Then I need to:

  • set any other checkboxes (certain ones) that may have a checkbox to a Quantity value of 0,
  • set the related quantity textbox to a different value for example 13.
  • update the info on my form to reflect same.

Any help is much appreciated.

function iWhichCheckboxChecked()
{
var chk_arr = document.getElementsByName(“Selected1”);
var chklength = chk_arr.length;
var iCount;

for(iCount=0; iCount&lt;chklength; iCount++)
{
	if (chk_arr[iCount].checked == true)
	{
	   document.Form1.Quantity1[iCount].value = '13';
	}

}

}

The HTML code that’s being generated seems to have the most significant problem at this stage, for the input tags are missing a closing > symbol.