1

我有以下脚本用于从下拉列表中选择日历日:

http://jsfiddle.net/nachosarmiento/XPj58/3/

$(document).ready(function () {

var calendario = new Date();
var una_noche = new Date();
var dos_noches = (new Date()).setDate(una_noche.getDate() + 1);
var tres_noches = (new Date()).setDate(una_noche.getDate() + 2);
var cuatro_noches = (new Date()).setDate(una_noche.getDate() + 3);
var cinco_noches = (new Date()).setDate(una_noche.getDate() + 4);
var atras = (new Date()).setDate(una_noche.getDate() - 1);

var dates;

var dates_in_string = '';

$('#simpliest-usage').multiDatesPicker({
    disabled: true,
    addDates: [una_noche]
});

$("#dias").on("change", function () {

    $('#simpliest-usage').multiDatesPicker('resetDates', 'picked');
    $('#simpliest-usage').multiDatesPicker('resetDates', 'disabled');


    if ($("#dias").val() == "1") {
        $('#simpliest-usage').multiDatesPicker({
            disabled: true,
            addDates: [una_noche]
        });

        dates = $('#simpliest-usage').multiDatesPicker('getDates');
        dates_in_string = '';

        for (var a in dates) dates_in_string += dates[a] + ' ';
        alert(dates_in_string);

    }

    if ($("#dias").val() == "2") {
        $('#simpliest-usage').multiDatesPicker({
            disabled: true,
            addDates: [una_noche, dos_noches]
        });

        dates = $('#simpliest-usage').multiDatesPicker('getDates');
        dates_in_string = '';

        for (var b in dates) dates_in_string += dates[b] + ' ';
        alert(dates_in_string);

    }

    if ($("#dias").val() == "3") {
        $('#simpliest-usage').multiDatesPicker({
            addDates: [una_noche, dos_noches, tres_noches],
            minDate: "una_noche"
        });

        dates = $('#simpliest-usage').multiDatesPicker('getDates');
        dates_in_string = '';

        for (var c in dates) dates_in_string += dates[c] + ' ';
        alert(dates_in_string);

    }

    if ($("#dias").val() == "4") {
        $('#simpliest-usage').multiDatesPicker({
            addDates: [una_noche, dos_noches, tres_noches, cuatro_noches],
            minDate: "una_noche"
        });

        dates = $('#simpliest-usage').multiDatesPicker('getDates');
        dates_in_string = '';

        for (var d in dates) dates_in_string += dates[d] + ' ';
        alert(dates_in_string);

    }

    if ($("#dias").val() == "5") {
        $('#simpliest-usage').multiDatesPicker({
            addDates: [una_noche, dos_noches, tres_noches, cuatro_noches, cinco_noches],
            minDate: "una_noche"
        });

        dates = $('#simpliest-usage').multiDatesPicker('getDates');
        dates_in_string = '';

        for (var e in dates) dates_in_string += dates[e] + ' ';
        alert(dates_in_string);

    }

});

});

它与 jQuery 1.7.2 完美搭配,但是当我想使用 jQuery 1.9.1 时它会停止工作。

有人知道这个问题的原因吗?

PD:官方网站: http: //multidatespickr.sourceforge.net/

谢谢你。

问候。

4

1 回答 1

3

jQuery 1.9 移除了该$.browser对象。

请参阅有关 jQuery“迁移”插件的此页面。

于 2013-10-22T20:18:35.493 回答