Hola,
Tengo la siguiente función, lo que hace es generar un calendario y resaltar los días en que halla fechas, algo así como un calendario de eventos, funciona bien en chrome, pero en ie8 no se ve nada, y en mozilla se ve el calendario con los días resaltados pero no funciona el alert. Que puede ser??
Código Javascript
:
Ver original$(document).ready(function () {
var events = [
<?php
$obj_agenda=new sQuery(); //Instanciamos la clase
//Ejecuta la consulta para mostrar la fecha
$query = 'SELECT age_fecha_compromiso, nombre FROM t_agenda, t_asunto WHERE t_agenda.activo_id=2';
$result = $obj_agenda->executeQuery($query);
// Recorremos todos los registros que haya soltado el query
while($row = mysql_fetch_array($result)) {
$fecha = date_create($row['age_fecha_compromiso']);
$fecha = date_format($fecha, 'm/d/Y');
$titulo = $row['nombre'];
?>
{ Title: "<? echo $titulo; ?>", Date: new Date("<? echo $fecha; ?>") },
<?php
}
?>
];
$('#datepicker').datetimepicker({
showSecond: true,
timeFormat: 'hh:mm:ss',
beforeShowDay: function(date) {
var result = [true, '', null];
var matching = $.grep(events, function(event) {
return event.Date.valueOf() === date.valueOf();
});
if (matching.length) {
result = [true, 'highlight', null];
}
return result;
},
onSelect: function(dateText) {
var date,
selectedDate = new Date(dateText),
i = 0,
event = null;
while (i < events.length && !event) {
date = events[i].Date;
if (selectedDate.valueOf() === date.valueOf()) {
event = events[i];
}
i++;
}
if (event) {
alert(event.Title);
}
}
});