Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/05/2007, 15:08
viktoria
 
Fecha de Ingreso: septiembre-2006
Mensajes: 349
Antigüedad: 18 años, 4 meses
Puntos: 0
Re: añadir un campo de texto con click del boton

Gracias programeitor!
Encontre un ejemplo interesante

num=0;
function add_autor(obj){
num++;
fi = document.getElementById('fiel'); // 1
contenedor = document.createElement('div'); // 2
contenedor.id = 'div'+num; // 3
fi.appendChild(contenedor); // 4

ele = document.createElement('input'); // 5
ele.type = 'text'; // 6
ele.name = 'autor'+num; // 6
contenedor.appendChild(ele); // 7


ele = document.createElement('input'); // 5
ele.type = 'text'; // 6
ele.name = 'mail'+num; // 6
contenedor.appendChild(ele); // 7


ele = document.createElement('input'); // 5
ele.type = 'button'; // 6
ele.value = 'Borrar'; // 8
ele.name = 'div'+num; // 8
ele.onclick = function () {borrar(this.name)} // 9
contenedor.appendChild(ele); // 7
}
function borrar(obj) {
fi = document.getElementById('fiel'); // 1
fi.removeChild(document.getElementById(obj)); // 10
}


y funciona, y recojo variables bien desde un archivo php, lo que no se como aplcar estilos a estos campos tipo text que creo y como averiguar el count total de campos creados.