Tema: for
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/10/2009, 10:44
sergiop21
 
Fecha de Ingreso: diciembre-2008
Mensajes: 805
Antigüedad: 16 años, 3 meses
Puntos: 20
for

Hola a todos!!!!

alguien me puede ayudar a hacer un for para que se me creen varios input

este es mi codigo pero no me los crea que hago mal??

function fEscribeDir()
{
addFormField(document.formu1,'text',+i);
//document.formu1.numficheros.value=i;
i=i+1;
}

function addFormField (form, fieldType, fieldName, fieldValue)
{
if (document.getElementById)
{

fila = document.createElement("tr");
columnas = document.createElement("td");
columnas.setAttribute("width", "144px");
var input = document.createElement('INPUT');
var div = document.createElement('DIV');
var cant = document.all.cantidad.value;

input.type = fieldType;
input.name = fieldName;
input.value = document.all.txtfec.value;



for (m=0; m <cant ;++m)
{
alert (m);
input.style.width="50px";
columnas.appendChild(input)
fila.appendChild(columnas)
div.appendChild(input);
document.getElementById('ficheros').appendChild(di v);
}
}
}
el alert me lo muestra bien, pero no me los crea