Mi funziona più o meno tutto, non riesco a fare andare solo il campo del contatore ... la funzione che ho tirato fuori è più o meno questa:
codice:
<!--
function generateTA() {
if (isNaN(document.getElementById('numTA').value)||parseInt(document.getElementById('numTA').value)-<%=risultato%>>20) {
  alert('Il valore deve essere numerico e compreso tra 1 e 20');
return;
 } // if (isNaN(document.getElementById('numTA').value)) 
if (isNaN(document.getElementById('numTA').value)||parseInt(document.getElementById('numTA').value)<<%=risultato%>) {
  alert('Il valore inserito non può essere minore di <%=risultato%> Per cancellare i colori selezionare la casella corrispondente ');
return;
 } // if (isNaN(document.getElementById('numTA').value)) 
 if (document.getElementById('numTA').value != parseInt(document.getElementById('numTA').value)) {
  alert('Il numero deve essere intero');
return;
 } // if (document.getElementById('numTA').value != parseInt(gdocument.etElementById('numTA').value))
 html = "";
   nb = document.getElementById('numTA').value;
  var textTA  = '<table width="500" height="20" align="center" cellspacing="2">\n';
  for (i=<%=risultato%>;i<nb;i++) {
    var idTA    = <%=risultato%>+i;
    textTA += '<tr><td width="112" height="20" class="formtext2"> Colore n°'+idTA+':</td>\n';
    textTA += '<td height="20" width="388" class="formtext2" colspan="2">';
	textTA += '<input type="text" name="ta'+idTA+'" id="'+idTA+'" size="6" maxlength="6" onkeyup="in_key(this);">';
	textTA += '<input type="checkbox" name="canc'+idTA+'" id='+idTA+' onclick="clk_chbx(this);"></td></tr>\n';
  }
  textTA += '</table>';
  html   = textTA; // non serve!!!
  document.getElementById('container').innerHTML = textTA; 
}
//-->
</script>
<script>
function in_key(tt) {
  var n = tt.name.substr(2);
  var cc = tt.form.elements('canc'+n);
  if(cc.checked) {
    cc.checked = false;
    return count(tt.form);
  }
  return false;
}

function clk_chbx(cc) {
  var n = cc.name.substr(4);
  var tt = cc.form.elements('ta'+n);
  if(tt.value.length) {
    tt.value = '';
    return count(cc.form);
  }
  return false;
}
  
function count(ff) {
  var n = <%=risultato%>;
  for(var i=<%=risultato%>; i<MAX; i++) {
    if(ff.elements('canc'+i).checked) n++;
  }
  ff.counter.value = MAX-n;
  return true;
}
</script>

Imput:
<input name="counter2" type="text" id="numTA" value="<%=sgnepz("numberc")%>" size="2" maxlength="2" >
<input name="button" type="button" onclick="generateTA()" value="ok">
Aiut!