【发布时间】:2014-09-17 17:19:11
【问题描述】:
我正在尝试使用带有下拉输入的 NoGray 日历,而不是通常的输入字段,以便有一个用于日期、月份和年份的下拉框,并且它们会更新日历并且日历会更新下拉菜单.
我让它像这样作为输入字段工作:
<select id="date1"></select><select id="month1"></select><select id="year1"></select>
<script src="PATH/TO/ng_all.js" type="text/javascript"></script>
<script src="PATH/TO/components/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
var my_cal1, my_cal2;
ng.ready(function(){
my_cal1 = new ng.Calendar({
input: {date:'date1', month:'month1', year:'year1'},
selected_date:new Date(),display_date:new Date(),
dates_off:[{date:26, month:11, year:2014},{date:27, month:11, year:2014},{date:28, month:11, year:2014},{date:29, month:11, year:2014},{date:30, month:11, year:2014},{date:31, month:11, year:2014}],
events:
{
onLoad: function()
{
var st_dt = this.get_start_date().clone();
console.log(this.is_selectable(st_dt)[0]);
while(!this.is_selectable(st_dt)[0])
{
st_dt = st_dt.from_string('today + 1');
}
// checking if no dates are selected
if (!ng.defined(this.get_selected_date()))
{
this.select_date(st_dt);
}
this.set_start_date(st_dt);
},
onDateClick: function(dt)
{
this.select_date(dt);
}
}
});
</script>
另外,我不想显示日历按钮,而是显示带有“打开日历”等文本的链接。
<a href="#" onClick="my_cal1.toggle('THE_DATE_IN_THE_DROP_DOWN_SELECT_BOXES')">Open Calendar</a>
请问怎么做,我似乎无法弄清楚?
提前致谢。
【问题讨论】:
标签: javascript jquery html validation calendar