jsDatePick – 使用选定日期

使用jsDatePick Full JQuery示例我无法在选择指定日期的情况下加载日历,我收到未分解的消息或语法错误

完整代码可以从JsDatePick下载

他们提供的准则

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*/ }); 

如果我然后取消对所选日期部分的评论,我会在加载日历时在日历上获得一个或者无法加载语法问题

有人可以帮忙吗?

谢谢

我遇到了同样的问题,并从这位德国研究员的post中找到了以下解决方案( http://www.viathinksoft.de/?page=news&id=184 )。 这篇文章是德文的,如果你用英文翻译,它会弄乱他提供的代码,所以先复制代码,或者你可以在下面复制。 这是他的修复,你需要修改“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”。

希望这可以帮助。

取消注释所选日期部分时,您是否在cellColorScheme:"beige"的末尾添加了一个cellColorScheme:"beige" ? 如果不是,您将收到语法错误。

我遇到了同样的问题,并且我在编辑页面上,因此我需要设置在jsDatePick日期中编辑的记录并将其显示在目标文本框中(我不能只在文本框中设置日期,这会导致首先是NaN问题)。 所以我的决议是Cesar的延伸:

 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; this.populateFieldWithSelectedDate(); } 

这会导致closeCalendar函数出现问题,需要将其更改为:

 JsDatePick.prototype.closeCalendar = function () { if (this.JsDatePickBox) { this.JsDatePickBox.style.display = "none"; document.onclick = function() {}; } };