该网页的地址 http://dry.4thebusiness.com/info/dhtml_calendar
1、在工程文件的根目录下运行下面的更新
ruby script/plugin install http://dhtml-calendar.googlecode.com/svn/trunk
2、在.rhtml文件中置入:
<%= dhtml_calendar_includes %>
这样就可以使用Calendar控件了。一共有5个模式供用户选择:
1、弹出式:页面只有一个日历牌的图标,用户点击后,弹出控件:
<%= popup_calendar 'person', 'birthday', { :class => 'date', :field_title => 'Birthday', :button_image => 'calendar.gif', :button_title => 'Show calendar' }, { :firstDay => 1, :range => [1920, 1990], :step => 1, :showOthers => true, :cache => true } %>
2、普通方式:日历完整显示在网页中:
<%= calendar 'person', 'birthday', { :class => 'date' }, { :firstDay => 1, :range => [1920, 1990], :step => 1, :showOthers => true } %>
3、输入框式:页面中显示一个输入框,鼠标点击后弹出日历供用户选择
<%= calendar_field 'person', 'birthday', { :class => 'date', :date => value, :field_title => 'Birthday', :button_title => 'Show calendar' }, { :firstDay => 1, :range => [1920, 1990], :step => 1, :showOthers => true, :cache => true } %>
4、选择框式:页面显示一个标准的选择框和一个日历的图表,点击后弹出日历
<%= calendar_select 'person', 'birthday', { :class => 'date', :date => value, :field_title => 'Birthday', :button_title => 'Show calendar' }, { :firstDay => 1, :range => [1920, 1990], :step => 1, :showOthers => true, :cache => true } %>
5、box:页面显示一个输入框和一个日历图表,点击图标后显示一个日历
<%= calendar_box 'person', 'birthday', { :class => 'date', :date => value, :field_title => 'Birthday', :form_name => 'custform', :button_title => 'Show calendar' }, { :firstDay => 1, :range => [1920, 1990], :step => 1, :showOthers => true, :cache => true } %>