简体   繁体   English

为什么禁用IE8中的日期与Jquery日期选择器无法正常工作

[英]Why disabling dates in IE8 not working properly with Jquery date picker

I currently have a datepicker from jquery where i am disabling national holidays. 我目前有一个来自jquery的日期选择器,我正在禁用国家法定假日。 It works fine in FF not not in IE 8. In IE i get the following error message: 它在FF中运行良好而不是在IE 8中。在IE中我收到以下错误消息:

SCRIPT5007: Unable to get property 'call' of undefined or null reference mainsearch_functions.js, line 230 character 7. SCRIPT5007:无法获取未定义或空引用mainsearch_functions.js的属性“调用”,第230行第7行。

the code i am using to block the holidays is below. 我用来阻止假期的代码如下。 Can someone tell me why this does not work on IE 8 有人能告诉我为什么这不适用于IE 8

function nationalDays(date) {

// federal holidays
natDays = [
           [1, 1, 'new years'], 
           [1, 21, 'Birthday of Martin Luther King, Jr.'], 
           [2, 18, 'Washington\'s Birthday'],
           [4, 27, 'Memorial Day'], 
           [7, 4, 'Independence Day'], 
           [9, 2, 'Labor Day'],
           [10, 14, 'Columbus Day'], 
           [11, 11, 'Veterans Day'], 
           [11, 28, 'Thanksgiving Day'],
           [12, 25, 'Christmas Day'], 

         ];
for (var i = 0; i < natDays.length; i++) {
  if (date.getMonth() == natDays[i][0] - 1 // ERROR HAPPENS HERE
      && date.getDate() == natDays[i][1]) {

    return [false, natDays[i][2],natDays[i][2]];
  }

}
return [true, '','Must be 5 business days out.'];
}

thank you in advance. 先感谢您。

You have a trailing comma in the natDays array natDays数组中有一个尾随逗号

[12, 25, 'Christmas Day'], 

I think IE8 inserts a NULL into the array because of this. 我认为IE8会因此而在数组中插入NULL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM