Salve a tutti.
Ho questo script associato ad un form HTML che invia tutti i campi (compresi quelli creati mediante questo script) ad un file php che li inserisce in un DB.
Codice PHP:
<script language="JavaScript" type="text/javascript">
<!--
var [
COLOR=orangered]num[/COLOR]=1;
function 
accoda(){
    if(
document.createElement && document.getElementById && document.getElementsByTagName) {
        
// crea elementi
        
var oTr=document.createElement("TR");
        var 
oTd1=document.createElement("TD");
        var 
oTd2=document.createElement("TD");
        var 
oField=document.createElement("INPUT");
        var 
oField2=document.createElement("INPUT");

        
// setta attributi
          
oField.setAttribute("type","text");
        
oField.setAttribute("name","software"+num);
          
oField.setAttribute("value","");
        
oField.setAttribute("cols","45");
        
oField.setAttribute("size","35");
        
        
oField2.setAttribute("type","text");
        
oField2.setAttribute("name","funzione"+num);
        
oField2.setAttribute("value","");
        
oField2.setAttribute("cols","45");
        
oField2.setAttribute("size","35");


        
// appendi al relativo padre
        
oTd1.appendChild(oField);
        
oTd2.appendChild(oField2);
        
oTr.appendChild(oTd1);
        
oTr.appendChild(oTd2);
        
document.getElementById('tabella').getElementsByTagName('TBODY')[0].appendChild(oTr);

        
// incrementa variabile globale
        
num++
    }
}

function 
rimuovi(){
    if(
document.removeChild && document.getElementById && document.getElementsByTagName) {
        
// se non e' la prima riga
        
if(num>1){
            
// riferimento al tbody
            
var tb=document.getElementById('tabella').getElementsByTagName('TBODY')[0];
            
// riferimento all' ultimo TR
            
var lastTr=tb.getElementsByTagName('TR')[(tb.getElementsByTagName('TR').length)-1]
            
// rimuovi
            
tb.removeChild(lastTr);
            
// decrementa variabile globale
            
num--
        }
    }
}
//-->
</script> 
Con lo script precedente,incremento e decremento la variabile num.

Col codice seguente richiamo le funzioni nel form HTML e creo un campo hidden contatore
Codice PHP:
    <input name="button" type="button" onClick="accoda()" value="accoda">
    <
input name="button" type="button" onClick="rimuovi()" value="rimuovi">
    <
input type="hidden" name="contatore"
Quel che vi chiedo è: come posso fare per associare num a contatore?
Grazie mille a tutti quelli che riusciranno a darmi una mano...