Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/02/2014, 19:12
Avatar de djaevi
djaevi
 
Fecha de Ingreso: marzo-2007
Ubicación: Moreno, Buenos Aires
Mensajes: 400
Antigüedad: 17 años, 2 meses
Puntos: 47
Respuesta: Duda en formulario Select

Deberias buscar informacion sobre el objeto Date de javascript, y como hacer operaciones matemáticas con fechas, una vez que tengas determinado a partir de que hora queres hacer el select solo se necesita un bucle y dom para generar el combo x ej:

Código Javascript:
Ver original
  1. function crearCombo(horaInicial) {  // SUPONGAMOS QUE RECIBE POR PARAMETRO LA HORA EN NUMERO
  2.  
  3.     var horaFinal = 24;
  4.  
  5.     var combo = document.getElementById("miCombo"); // ACA SELECCIONO EL COMBO DONDE DESEAS CARGAS LAS OPCIONES.
  6.    
  7.         combo.options.length = 0; // LIMPIAR EL COMBO SI TENIA OPCIONES ESTABLECIDAS
  8.    
  9.     while(horaInicial <= horaFinal) {
  10.  
  11.         var opcion = document.createElement("option");
  12.             opcion.value = horaInicial;
  13.             opcion.text = horaInicial + ":00";
  14.  
  15.             combo.appendChild(opcion);
  16.  
  17.         horaInicial++;
  18.  
  19.     }
  20.  
  21. }

Prueba con eso a ver si te funciona cualquier duda, te hecho una mano.

Saludos