Salve,
ho trovato questo script dal sito riportato qui sotto, però funziona solo con un field.
A me servirebbe al click di un bottone, duplicare 3 textfield alla volta.
Se provo a farlo con questa funzione, sul contatore dei field esce NaN per cui non funziona.

codice:
// Add more fields dynamically.
// http://binnyva.blogspot.com/2006/01/...ration-in.html
// -------------------------------------------------------------------------
function addField(area,field,limit) {
	if(!document.getElementById) return; // Prevent older browsers from getting any further.
	var field_area = document.getElementById(area);
	var all_inputs = field_area.getElementsByTagName("input"); // Get all the input fields in the given area.
	// Find the count of the last element of the list. It will be in the format '<field><number>'. If the 
	// field given in the argument is 'friend_' the last id will be 'friend_4'.
	var last_item = all_inputs.length - 1;
	var last = all_inputs[last_item].id;
	var count = Number(last.split("_")[1]) + 1;
	// If the maximum number of elements have been reached, exit the function.
	// If the given limit is lower than 0, infinite number of fields can be created.
	if(count > limit && limit > 0) return;
	if(document.createElement) { // W3C Dom method.
		var li = document.createElement("li");
		var input = document.createElement("input");
		input.id = field+count;
		input.name = field+count;
		input.type = "text"; // Type of field - can be any valid input type like text,file,checkbox etc.
		li.appendChild(input);
		field_area.appendChild(li);
	} else { // Older Method
		field_area.innerHTML += "[*]<input name='"+(field+count)+"' id='"+(field+count)+"' type='text' />";
	}
}
I field da duplicare ad evento click dovrebbero essere questi
codice:
  1. <input name="g_variable_n_0" id="g_variable_n_0" class="inputbox" value="0" type="text" style="width:30px;margin-right:10px;" /> nome: <input name="g_variable_var_0" id="g_variable_var_0" class="inputbox" value="" type="text" style="width:300px;margin-right:10px;" /> prezzo: <input name="g_variable_price_0" id="g_variable_price_0" class="inputbox" value="" type="text" style="width:60px;margin-right:10px;" /></p>
Come è possibile ovviare?
Scusate ma di Js non sono per niente bravo, ma riesco a malapena a modificare dei parametri perciò non saprei come modificare in maniera sostanziale questa funzione.
Se qualcuno ha qualcos'altro di già pronto posti pure il link.

Grazie in anticipo

ps> anche con questo thread
http://forum.html.it/forum/showthrea...hreadid=848168
ho lo stesso problema: duplicare un field ok, duplicarne 3 non va...