使用 jsDatePick Full JQuery 示例,我无法让日历加载选定的指定日期,我收到未定义的消息或语法错误
完整代码可以从以下网址下载日期选择 http://javascriptcalendar.org/
他们提供的代码
g_globalObject2 = new JsDatePick({
useMode:1,
isStripped:false,
target:"div4_example",
cellColorScheme:"beige"
/*
selectedDate:{
day:16,
month:3,
year:2013
},
yearsRange:[1978,2020],
limitToToday:false,
dateFormat:"%m-%d-%Y",
imgPath:"img/",
weekStartDay:1*/
});
如果我取消注释选定的日期部分,加载后我要么在日历上未定义,要么因语法问题而无法加载
有人可以帮忙吗?
Thanks
我遇到了同样的问题,并从这位德国人的帖子中找到了以下解决方案()。该帖子是德语的,如果您将其翻译成英语,则会弄乱他提供的代码,因此请先复制代码,或者您可以复制下面的代码。
这是他的修复,您需要修改“jsDatePick.full.1.3.js”脚本,函数“setConfiguration”,如下所示:
this.selectedDayObject = {};
this.flag_DayMarkedBeforeRepopulation = false;
this.flag_aDayWasSelected = false;
this.lastMarkedDayObject = null;
if (!this.oConfiguration.selectedDate){
this.currentYear = this.oCurrentDay.year;
this.currentMonth = this.oCurrentDay.month;
this.currentDay = this.oCurrentDay.day;
} else {
this.currentYear = this.oConfiguration.selectedDate.year;
this.currentMonth = this.oConfiguration.selectedDate.month;
this.currentDay = this.oConfiguration.selectedDate.day;
this.selectedDayObject = this.oConfiguration.selectedDate;
this.flag_aDayWasSelected = true;
}
基本上,他将“else”条件和操作添加到代码中。
在 HTML 中,您需要使用“jsDatePick.full.1.3.js”。
希望这可以帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)