使用哪个javascript datepicker插件/库来获得最大的灵活性

时间:2012-01-23 23:07:48

标签: javascript jquery html css datepicker

我知道通用的javascript datepickers很多,但它们看起来都不起眼。即使是jQuery UI datepicker看起来也有点过时了。我现在可以使用看起来粗糙的一个,但后来我们想要改进它的外观(使其更符合UI的其余部分)并且我不想通过挑选来拍摄自己的脚一个难以改变的。我只谈论化妆品CSS / HTML更改(或模板)

您会从模板灵活性角度推荐哪个日期/日历JavaScript插件?

谢谢,

2 个答案:

答案 0 :(得分:4)

我总是发现jQuery UI Datepicker很棒。 jQuery UI有很多主题,你可以roll your own。如果你花时间让它看起来你想要它,它绝对不会过时。

答案 1 :(得分:2)

使用Jquery UI,http://jqueryui.com/demos/datepicker/

这样您就不必再添加任何库了。它具有您需要的几乎所有功能以及良好的文档。见下面的例子

(文档)$。就绪(函数(){

    // the jquery calendar
    $( "#yourId" ).datepicker({
        showOn: "both", // show on clicking image as well as text box
        yearRange: "2000:2030",
        buttonImage: imagePath+"/b-calendar.gif", // custom image
        buttonImageOnly: true,
        dateFormat: 'dd-M-yy',
        showOtherMonths: true,
        selectOtherMonths: true
        ,changeMonth: true
        ,changeYear: true
        //,showAnim:"slideDown"
        ,buttonText: 'Show Calendar'
        //,showButtonPanel : true
        ,prevText: 'Previous Month'
        ,nextText: 'Next Month'
        ,beforeShow: function (textbox, instance) { // work around 4 alignment 
            instance.dpDiv.css({
                    marginTop: (-textbox.offsetHeight) + 'px',
                    marginLeft: textbox.offsetWidth + 30+ 'px'
        });
        }
    });
});