Bootstrap日历突出显示当前日期

时间:2014-02-03 12:44:45

标签: jquery twitter-bootstrap datepicker twitter-bootstrap-2

我想突出显示日历的当前日期

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
     <link href="css/bootstrap_calendar.css" rel="stylesheet">
     <script src="js/bootstrap_calendar.min.js"></script>
    <script type="text/javascript">
            $(document).ready( function(){
                theMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
                theDays = ["S", "M", "T", "W", "T", "F", "S"];

                $('.calendar_test').calendar({
                    months: theMonths,
                    days: theDays,
                    req_ajax: {
                        type: 'get',
                        url: 'json.php'
                    }
                });
            });
        </script>

我的HTML代码

<div class="calendar_test"></div>

参考:http://lab.xero.nu/bootstrap_calendar/

1 个答案:

答案 0 :(得分:0)

你的json.php必须返回类似的内容:

<?php

$array = array(
  array(
    "DATE_OF_TODAY", // you must format the date of the day correctly for the calendar.
    'Today', 
    '#', 
    'blue' //the color that the day must have (accepts also hexa value)
  )
);

header('Content-Type: application/json');
echo json_encode($array);
exit;
?>