使用 JavaScript 创建日历(例如 jquery Datepicker )的最佳方法是什么,我可以在其中添加更多功能?
我想在其中显示一些不同颜色的日期数组以及选择一个日期。
我应该尝试编辑源代码,还是更好地使用一些库并自己完成?
对于第一种情况,我想找到一些关于 jquery Datepicker 源的良好文档。对于第二个,我想找到一些库,它可以创建一个良好且易于使用的日历。
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.
发布评论
评论(4)
jQueryUI 的 datepicker 已经有了这个。
疯狂演示
,你可以更多。尝试阅读 event-beforeShowDay
jQueryUI's datepicker already have this.
crazy demo
and you could do more. Try reading event-beforeShowDay
如果您不介意自己编写一些代码,可以尝试我的 calendar-logic.js 。
它根本没有 UI。您将完全控制日历的外观和行为,而不必担心一个月有多少周等背后的数学。
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.
jQuery Datepicker 小部件已经为日历提供了足够的功能。添加自定义颜色更多的是一种样式(因此是 CSS)的事情。此外,文档很容易找到, 也是如此谷歌搜索它。
最后,编辑源代码从来都不是一个好主意,因为升级会覆盖您的更改。
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.
看看 extjs 日历 - 它看起来更具可扩展性 - 并且还有一个专业版本(付费)
http://www.sencha.com/blog/2010/09/08/ext-js-3-3-calendar-component/
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.com/blog/2010/09/08/ext-js-3-3-calendar-component/