Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/02/2011, 20:38
walterdevel
 
Fecha de Ingreso: diciembre-2010
Mensajes: 788
Antigüedad: 13 años, 4 meses
Puntos: 51
Respuesta: cantidad insertada convertida en combo

Necesitás algo así creería, si entendí bien:

Código HTML:
Ver original
  1. <input type="text" id="cantidad" />
  2. <input type="button" value="Enviar" onclick="llenarCombo()" />
  3.  
  4. <br />
  5. <select id="sel_cantidad">
  6.  


Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. function llenarCombo() {
  3.    var cantidad = parseInt(document.getElementById("cantidad").value);
  4.    var opciones = "";
  5.    for(var i = 1; i < cantidad+1; i++) {
  6.      opciones += "<option value='"+i+"'>"+i+"</option>";
  7.    }
  8.    selcant = document.getElementById("sel_cantidad");
  9.    selcant.innerHTML = opciones;
  10. }
  11. </script>