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

时间:2013-11-29 19:20:48

标签: javascript jquery internet-explorer-8

我目前有一个来自jquery的日期选择器,我正在禁用国家法定假日。它在FF中工作正常,而不是在IE 8中。在IE中,我收到以下错误消息:

SCRIPT5007:无法获取未定义或空引用的属性“调用” mainsearch_functions.js,第230行第7个字符。

我用来阻止假期的代码如下。有人能告诉我为什么这不适用于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.'];
}

提前谢谢。

1 个答案:

答案 0 :(得分:2)

natDays数组

中有一个逗号逗号
[12, 25, 'Christmas Day'], 

我认为IE8会因此而在数组中插入NULL。