Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/02/2008, 05:58
lfc
 
Fecha de Ingreso: febrero-2008
Mensajes: 23
Antigüedad: 17 años, 1 mes
Puntos: 0
Calendario generado dinámicamente con javascript

Hola!

Estoy intentando generar un calendario para seleccionar una fecha y una hora con javascript. He encontrado muchos ejemplos del siguiente estilo que funcionan:

Código:
<form>
  <input type="text" id="date" name="date" />
  <input type="button" id="butt" value="..." />
</form>

<script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "date",
      ifFormat    : "%d/%m/%Y",
      button      : "butt"
    }
  );
</script>
Pero lo que yo quiero hacer es lo siguiente (dentro de un script y habiendo incluido los .js i .css necesarios):

Código:
txt = document.createTextNode('Start Time: ');
divdest.appendChild(txt);
st = document.createElement('input');
st.name = 'txtdate';
st.value = '';
divdest.appendChild(st);
butt = document.createElement('button');
butt.value = '...';
butt.id = 'butt';
divdest.appendChild(butt);

var cal = new Calendar.setup({
	inputField     :    'txtdate';,     // id of the input field
	singleClick    :     false,     // require two clicks to submit
	ifFormat       :    '%a, %b %e, %Y [%I:%M %p]',     // format of the input field
	showsTime      :     true,     // show time as well as date
	button         :    'butt';  // trigger button 
});
(divdest es un div que he creado anteriormente)
Pero esto no funciona, si alguien me pudiera decir como hacer para crear un calendario generado completamente con javascript (sin la necesidad de definir los inputs con html).

Muchas gracias!!!!