admin管理员组文章数量:1332649
What is the best way to create a calendar with JavaScript like the jquery Datepicker where I can add some more functionality?
I want to display some arrays of dates in different colors in it as well as selecting a date.
Shall I try to edit the source code, or better, use some library and do it myself?
For the first case I would like to find some good documentation of the jquery Datepicker source. For the second I would like to find some library, which creates a good and easy to use calendar.
What is the best way to create a calendar with JavaScript like the jquery Datepicker where I can add some more functionality?
I want to display some arrays of dates in different colors in it as well as selecting a date.
Shall I try to edit the source code, or better, use some library and do it myself?
For the first case I would like to find some good documentation of the jquery Datepicker source. For the second I would like to find some library, which creates a good and easy to use calendar.
Share Improve this question edited Oct 5, 2010 at 9:32 Reigel Gallarde 65.3k21 gold badges125 silver badges142 bronze badges asked Oct 5, 2010 at 8:57 hellehelle 11.7k9 gold badges57 silver badges85 bronze badges4 Answers
Reset to default 5I want to display some arrays of dates in different colors in it as well as selecting a date.
jQueryUI's datepicker already have this.
crazy demo
$(function() {
var someDates = ['10/8/2010', '10/28/2010', '10/30/2010']; // the array of dates
$("#datepicker").datepicker({
beforeShowDay: function(date) {
for (var i = 0; i < someDates.length; i++) {
if (new Date(someDates[i]).toString() == date.toString()) {
return [true,'someDates']; // someDates here is a class
// with that added class you could do your style..
// html would then be rendered something like this,
// <td class="someDates"><a href="">8</a></td>
}
}
return [true];
}
});
});
and you could do more. Try reading event-beforeShowDay
If you don't mind writing some code of your own, you could try my calendar-logic.js.
It does no UI at all. You'll get full control of the look and behaviour of the calendar, without having to worry about the math behind how many weeks there are in a month, etc.
The jQuery Datepicker widget already provides enough functionality for a calendar. Adding custom colors is more of a style (thus CSS) thing. Also, documentation is very easy to find, so is Googling for it.
Lastly, editing the source code is never a good idea, since an upgrade will overwrite your changes.
Have a look at the extjs calendar - it looks far more extensible - and there is a pro version (paid for ) as well
http://www.sencha./blog/2010/09/08/ext-js-3-3-calendar-ponent/
本文标签: jquerycalendar widget in javascriptStack Overflow
版权声明:本文标题:jquery - calendar widget in javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742260261a2442381.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论