ciao a tutti,
ho trovato nella sezione script utili come creare dinamicamente dei campi a un form, ho provato a riadattarlo ai miei bisogni ma purtroppo non funziona sotto IE (funziona invece con Firefox e Safari)


vi posto il codice, se non capite qualunque cosa posso dare ogni chiarimento.

grazie a tutti
danno

codice:
<html>
<head>
<script language="javascript" type="text/javascript">
var restaurants = 2;

function more_rest()
{	var main_tr=document.createElement("TR");
	var main_td=document.createElement("TD");
	var new_table=document.createElement("TABLE");
	var labels=new Array("Restaurant #","Name","Location","Type of the Food","Meals Served","Rating","Dress Code","Serving Times","Breakfast","Lunch","Dinner","Brunch","Description");
	
	//in un ciclo
	for(i=0;i<13;i++)
	{	var new_tr=document.createElement("TR");
		var new_td1=document.createElement("TD");
		if(i>7 && i<12)
			new_td1.align = 'right';
		var new_td2=document.createElement("TD");
		if(i==0)
			var new_label=document.createTextNode(labels[i]+restaurants+':');
		else
			var new_label=document.createTextNode(labels[i]+':');
		var new_field=document.createElement("INPUT");
		new_field.type = 'text';
		
		//appende i figli al padre
		new_td1.appendChild(new_label);
		new_td2.appendChild(new_field);
		new_tr.appendChild(new_td1);
		new_tr.appendChild(new_td2);
		new_table.appendChild(new_tr);
	}
	main_td.appendChild(new_table);
	main_tr.appendChild(main_td);
	document.getElementById('rest_table').getElementsByTagName('TBODY')[0].appendChild(main_tr);
	
	restaurants++;
}
</script>
</head>

<body>
<table id="rest_table">
	<tr>
		<td>
			<table>
				<tr><td>Restaurant #1</td><td><input type="text"></td></tr>
				<tr><td>Name:</td><td><input type="text"></td></tr>
				<tr><td>Location</td><td><input type="text"></td></tr>
				<tr><td>Type of the Food</td><td><input type="text"></td></tr>
				<tr><td>Meals Served</td><td><input type="text"></td></tr>
				<tr><td>Rating:</td><td><input type="text"></td></tr>
				<tr><td>Dress Code:</td><td><input type="text"></td></tr>
				<tr><td>Serving Times:</td><td><input type="text"></td></tr>
				<tr><td align="right">Breakfast:</td><td><input type="text"></td></tr>
				<tr><td align="right">Lunch:</td><td><input type="text"></td></tr>
				<tr><td align="right">Dinner:</td><td><input type="text"></td></tr>
				<tr><td align="right">Brunch:</td><td><input type="text"></td></tr>
				<tr><td>Description:</td><td><input type="text"></td></tr>
			</table>
		</td>
	</tr>
</table>

<input type="button" value="more restaurants >>" onClick="javascript:more_rest()">


</body>