Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在日期选择器的日期中添加链接_Jquery_Jquery Ui_Indexing_Datepicker - Fatal编程技术网

Jquery 在日期选择器的日期中添加链接

Jquery 在日期选择器的日期中添加链接,jquery,jquery-ui,indexing,datepicker,Jquery,Jquery Ui,Indexing,Datepicker,我有一个事件日历,需要在事件日添加链接,我使用的是日期选择器jqueryui 有人知道一种获取当天指数的方法吗 我的代码: $.ajax({ url: "includes/ajax/datepicker_events.php", data: "action=showdates", dataType: "json", success: function(calendarEvents){

我有一个事件日历,需要在事件日添加链接,我使用的是日期选择器jqueryui

有人知道一种获取当天指数的方法吗

我的代码:

$.ajax({
            url: "includes/ajax/datepicker_events.php",
            data: "action=showdates",
            dataType: "json",
            success: function(calendarEvents){
                $("#datepicker").datepicker({
                    numberOfMonths: [1, 1],
                    showCurrentAtPos: 0,
                    beforeShowDay: function (date){
                        for (i = 0; i < calendarEvents.length; i++) {
                            if (date.getMonth() == calendarEvents[i][0] - 1
                              && date.getDate() == calendarEvents[i][1]
                              && date.getFullYear() == calendarEvents[i][2]) {

                              return [false,"ui-state-active",calendarEvents[i][3]];
                              }
                        }
                        return [true, ""];
                    }
                });
            }
        });
$.ajax({
url:“includes/ajax/datepicker_events.php”,
数据:“操作=显示日期”,
数据类型:“json”,
成功:功能(日历事件){
$(“#日期选择器”)。日期选择器({
numberOfMonths:[1,1],
showCurrentAtPos:0,
beforeShowDay:功能(日期){
对于(i=0;i
我会在选择日期时使用onSelect打开一个新链接

var calendarEvents = [[10,22,2013],[10,24,2013]];
var calendarHref = ["https://stackoverflow.com","https://google.com"];

$("#datepicker1").datepicker({
    numberOfMonths: [1, 1],
    showCurrentAtPos: 0,
    beforeShowDay: function (date) {
        for (i = 0; i < calendarEvents.length; i++) {
            if (date.getMonth() == calendarEvents[i][0] - 1 && date.getDate() == calendarEvents[i][1] && date.getFullYear() == calendarEvents[i][2]) {

                return [true, "ui-state-active", calendarEvents[i][3]];
            }
        }
        return [true, ""];
    },
    onSelect: function(dateText, inst) {
        for (i = 0; i < calendarEvents.length; i++) {
            if (inst.selectedMonth == calendarEvents[i][0] - 1 && inst.selectedDay == (""+ calendarEvents[i][1]) && inst.selectedYear == calendarEvents[i][2]) {
                window.open(
                  calendarHref[i],
                  '_blank'
                );
            }
        }
    }
});
var calendarEvents=[[10,222013]、[10,242013];
var calendarHref=[”https://stackoverflow.com","https://google.com"];
$(“#日期选择器1”)。日期选择器({
numberOfMonths:[1,1],
showCurrentAtPos:0,
beforeShowDay:功能(日期){
对于(i=0;i