Ver Mensaje Individual
  #7 (permalink)  
Antiguo 24/04/2013, 13:49
Avatar de tquezada
tquezada
 
Fecha de Ingreso: febrero-2013
Ubicación: Santiago
Mensajes: 196
Antigüedad: 11 años, 2 meses
Puntos: 8
Respuesta: rescatar value de un combobox

gracias edward18_1 y uriss por sus respuestas ya lo logre hacer y era justamente con el split() jeje

Código Javascript:
Ver original
  1. <script language="javascript">function crearText()
  2. {
  3.   document.getElementById("idSeleccionado").value = '';
  4.     /*Obtencion del indice seleccionado*/
  5.   var indexSeleccion = document.getElementById('seleccion').selectedIndex;
  6.   /*Obtencion del value compuesto pór [id-integrantes]*/
  7.   var valorObtenido = document.getElementById('seleccion').options[indexSeleccion].value.split('-');
  8.   document.getElementById("idSeleccionado").value = valorObtenido[0];
  9.  
  10.   var actuales = document.getElementById('seccion');
  11.   var cant=actuales.childNodes.length;
  12.   for(var f=0;f<cant;f++)
  13.   {
  14.     actuales.removeChild(actuales.childNodes[0]);
  15.   }
  16.  
  17.   var cantidad = 0;
  18.   for(var f=0;f<valorObtenido[1];f++)
  19.   {
  20.     cantidad++;
  21.     var nuevohijo  = document.createElement('input');
  22.     nuevohijo.type = 'text';
  23.     nuevohijo.name = 'deporte[]';
  24.     nuevohijo.id   = 'nombre' + cantidad;
  25.     document.getElementById('seccion').appendChild(nuevohijo);
  26.     document.getElementById('seccion').appendChild(document.createElement('br'));
  27.   }
  28. }
  29. </script>

Gracias de verdad!!
__________________
¿Sabes cuántos programadores hacen falta para cambiar una bombilla? - no, no ¿Cuántos? - Ninguno... es un problema de hardware.