hi,

I have a problem that can not resolve, probably because of my lack of knowledge of javascript.

Explain what it is:

I have two functions that add and remove a set of fields





<script type="text/javascript">

function addRow(){

var nForm = document.forms[0];
var nClone = nForm.getElementsByTagName('table')[0].cloneNode(true);
var nFloor = document.getElementById('floor');
nForm.insertBefore(nClone,nFloor);
var nTable = document.getElementsByTagName('table');
nTable[nTable.length-1].getElementsByTagName('td')[0].firstChild.data = nTable.length;
var nField = nTable[nTable.length-1].getElementsByTagName('input');
for (i=0; i<nField.length; i++)
{
nField[i].value = "";
}
}


function removeRow(){

var nForm = document.forms[0];
var nTable = nForm.getElementsByTagName('table');
var lastTable = nTable[nTable.length-1];
if (nTable.length > 1)
{
nForm.removeChild(lastTable);
}
}

</script>



The contents of the form is as follows ...


<form action="prova2.asp?save=<%="yes"%>" method="post" >
<table>
<tr>

<td><INPUT type="checkbox" style="font-family:tahoma; font-size:11px; margin-right:3px" id="key" name="Key_[]"> </td>
<td><input type="text" maxlength=25 size=25 style="font-family:tahoma; font-size:11px; margin-right:3px" name="fld_[]"></td>
<td>
<select size=1 style="font-family:tahoma; font-size:11px; margin-left:17px " id="type" name="typ_[]" onchange="java-script:KeyCliK();" >
<%
dim RSType
set RSType = Server.CreateObject("ADODB.RECORDSET")
RSType.ActiveConnection=Objconn
RSType.Open("select * from sys.systypes order by name")
Response.Write("<option selected>Scegli un data type</option>")
while not RSType.EOF
Response.Write "<option value=" & trim(RSType(0)) & ">" & RSType(0) & "</option>" & vbcrlf
RSType.movenext
wend
RSType.close
set RSType=nothing
%>
</select>
</td>
<td><input type="text" maxlength=8 size=8 style="font-family:tahoma; font-size:11px; margin-right:3px" name="lnt_[]"></td>
<td><input type="text" maxlength=8 size=8 style="font-family:tahoma; font-size:11px; margin-right:3px" name="prc_[]"></td>
<td><input type="text" maxlength=8 size=8 style="font-family:tahoma; font-size:11px; margin-right:3px" name="scl_[]"></td>
<td><input type="text" maxlength=8 size=8 style="font-family:tahoma; font-size:11px; margin-right:3px" name="dft_[]"></td>
<td><INPUT type="checkbox" style="font-family:tahoma; font-size:11px; margin-right:3px" id="null" name="nll_[]" ></td>
<td><INPUT type="checkbox" style="font-family:tahoma; font-size:11px; margin-right:3px" id="identity" name="idt_[]"></td>
<td><input type="text" maxlength=8 size=8 style="font-family:tahoma; font-size:11px; margin-right:3px" id="offset" name="off_[]"></td>
<td><input type="text" maxlength=8 size=8 style="font-family:tahoma; font-size:11px; margin-right:3px" id="increment" name="inc_[]" ></td>
</tr>
</table>

<input type="button" id="floor" value="Aggiungi input" onclick="addRow();">
<input type="button" value="Elimina input" onclick="removeRow();">
<input type="submit" value="Crea">
</form>




I have another javascript function that it set's (or rather should ...) certain values on some fields when the first checkbox is checked and the data type (the third field of the form) is integer.
The checkbox checked and the data type as integre means that there is a key field and therefore automatically check box "Identity", Offset identity and the increment identity are setted automatically.
Then disabled the checkbox null and identity.
All of this in which I have described.

Function is ...


<script type="text/javascript">

function KeyCliK()
{
if ((document.getElementById('key').checked) && (document.getElementById('type').value) == "int")
{


document.getElementById('identity').checked=true;
document.getElementById('null').checked=false;
document.getElementById('offset').value=1;
document.getElementById('increment').value=1;
document.getElementById('identity').disabled=true;
document.getElementById('null').disabled=true;
}
else
{
document.getElementById('identity').checked=false;
document.getElementById('null').checked=true;

}
}
</script>




The problem is that this function works only on the first set of fields.
If I have added two additional series of fields with the function add () initially described from the seconds range onwards the function KeyCliK () does not go.

Can you help?

Thanks in advance