uf, al fin, despues de tanto intentarlo, finalmente dí con el código. Aquí se los dejo por si a alguien le puede servir:
(crea una tabla dinamica que contiene un input y además un botón de borrar el elemento creado)
Código:
<script>
var n=0;
function add() {
n++;
pepe = document.getElementById('tabla');
fila = document.createElement('tr');
fila.id='contenedor'+n;
celda = document.createElement('td');
fila.appendChild(celda);
code=document.createElement('input');
code.type='text';
code.name='alternativa_'+n;
code.id='alternativa_'+n;
code.size='50';
code.maxlength='100';
celda.appendChild(code);
celda = document.createElement('td');
fila.appendChild(celda);
cant=document.createElement('input');
cant.type='button';
cant.value='X';
cant.onclick = function() {del(this.parentNode.parentNode.rowIndex)};
celda.appendChild(cant);
pepe.appendChild(fila);
document.getElementById('cuantos').value = n;
}
function del(obj){
document.getElementById('tabla').deleteRow(obj)
n--;
document.getElementById('cuantos').value = (document.getElementById('cuantos').value-1);
}
</script>
<input type="text" name="cuantos" value="0" size="3" readonly> <input type="button" value=" AGREGAR+ " onclick="add()">
<table border="1">
<tbody id="tabla">
</tbody>
</table>
Saludos!