Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/07/2009, 07:42
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 4 meses
Puntos: 126
Respuesta: agrear tantos textbox como se quiera

Hola

Algo como esto

Código javascript:
Ver original
  1. function crearCampos(cantidad){
  2. var div = document.getElementById("campos_dinamicos");
  3. while(div.firstChild)div.removeChild(div.firstChild); // remover elementos;
  4.     for(var i = 1, cantidad = Number(cantidad); i <= cantidad; i++){
  5.     var salto = document.createElement("P");
  6.     var input = document.createElement("input");
  7.     var text = document.createTextNode("Campo Dinamico " + i + ": ");
  8.     input.setAttribute("name", "campo" + i);
  9.     input.setAttribute("size", "12");
  10.     input.className = "input";
  11.     salto.appendChild(text);
  12.     salto.appendChild(input);
  13.     div.appendChild(salto);
  14.     }
  15. }

Código html:
Ver original
  1. <input type="text" name="cantidad" id="cantidad" value="" onkeyup="crearCampos(this.value);" />

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />