Ciao a tutti, sono un neofita del javascript.

Sto scrivendo una pagina php che mi permette di creare una tabella nel database con numero e tipo di campi arbitrario.

Siccome il codice php è già parecchio complicato di suo volevo implementare l'aggiunta o la rimozione di campi tramite javascript e DOM.
Per fare questo ho scritto questo codice (per ora studiato solo x IE):
codice:
var nFieldsCount = 5;
function crea_campo() {
	if(document.getElementById)
	{
		var tr = document.createElement('TR');
		var td = document.createElement('TD');
		var input = document.createElement('INPUT');
		input.setAttribute('type', 'text');
		input.setAttribute('name', 'name_item'+nFieldsCount);
		td.appendChild(input);
		tr.appendChild(td);

		td = document.createElement('TD');
		var sel = document.createElement('SELECT');
		sel.setAttribute('name', 'type_item'+nFieldsCount);
		var option, i=0;
		var types = new Array("VARCHAR", "TINYINT", "TEXT", "DATE", "SMALLINT", "MEDIUMINT", "INT", "BIGINT", "FLOAT", "DOUBLE", "DECIMAL", "DATETIME", "TIMESTAMP", "TIME", "YEAR", "CHAR", "TINYBLOB", "TINYTEXT", "BLOB", "MEDIUMBLOB", "MEDIUMTEXT", "LONGBLOB", "LONGTEXT", "ENUM", "SET");
		while(i < types.length) {
			option = document.createElement('OPTION');
			option.setAttribute('value', types[i]);
			sel.appendChild(option);
			i++;
		}
		td.appendChild(sel);
		tr.appendChild(td);

		td = document.createElement('TD');
		input = document.createElement('INPUT');
		input.setAttribute('type', 'text');
		input.setAttribute('name', 'length_item'+nFieldsCount);
		input.setAttribute('value', 255);
		td.appendChild(input);
		tr.appendChild(td);
		
		var table = document.getElementById('detailform');
		table.appendChild(tr);

		nFieldsCount++;
	}
}
Il problema è: NON FUNZIONA!!
IE esegue il codice senza ritornare alcun errore ma graficamente non fa nulla!

P.S. I form sono inseriti in una struttura tabella del tipo

<table id='detailform'>
<tr>
<td><input nome campo></td>
<td><select tipi campo></td>
<td><input dimensione campo></td>
</tr>
</table>


AIUTATEMI PLEASE!!!!!!!!!!