这段代码是日期控件的js时间只能选择每周四的日期,我现在要改成每周三怎么改

  1. this._createCalendar = function(){  

  2.     var o = this.options;  

  3.     var self = this;  

  4.     if (this.options.need2BuildConfig === true && this.options.data) {  

  5.         this.options.data.resetStatus(this.createDependencePara4Data());  

  6.         var data = this.options.data.getData();  

  7.         if (data[0].data) {  

  8.             if (data[0].data.startDate) {  

  9.                 var sd = new Date(data[0].data.startDate);  

  10.                 if (!FR.isInvalidDate(sd)) {  

  11.                     o.startDate = FR.date2Str(sd, 'yyyy-MM-dd');  

  12.                     this.std = this._createStartDate(o.startDate, o.format, this.viewMode);  

  13.                 }  

  14.             }  

  15.             if (data[0].data.endDate) {  

  16.                 var ed = new Date(data[0].data.endDate);  

  17.                 if (!FR.isInvalidDate(ed)) {  

  18.                     o.endDate = FR.date2Str(ed, 'yyyy-MM-dd');  

  19.                     this.edd = this._createEndDate(o.endDate, o.format, this.viewMode);  

  20.                 }  

  21.             }  

  22.         }  

  23.         this.options.rebuildConfig = false;  

  24.     }  

  25.     this.datepicker = new FR.DatePicker({  

  26.         renderEl: this.$view,  

  27.         viewMode: this.viewMode,  

  28.         date: FR.str2Date(this.editComp.val(), o.format),  

  29.         dateFormat: o.format,  

  30.         startDate: this.std,  

  31.         endDate: this.edd,  

  32.         onDateUpdate:function(){  

  33.             if ($(':focus').length === 0) {  

  34.                 self.editComp.focus();  

  35.             }  

  36.             self.editComp.val(FR.date2Str(this.getValue(), o.format));  

  37.             self.isValidateInput();  

  38.             self.fireEvent(FR.Events.AFTEREDIT);  

  39.         }  

  40.     });  

  41.     this.datepicker._loadDateData = function (table, date) {  

  42.         if (!date) {  

  43.             return;  

  44.         }  

  45.         var year = date.getFullYear(),  

  46.             month = date.getMonth(),  

  47.             day = date.getDate();  

  48.         var today = new Date(),  

  49.             TY = today.getFullYear(),  

  50.             TM = today.getMonth(),  

  51.             TD = today.getDate();  

  52.         this.cache.showYear = year;  

  53.         this.cache.showMonth = month;  

  54.         var std = this.options.startDate,  

  55.             edd = this.options.endDate;  

  56.         table.$title.text(Date._MN[month] + ", " + year);  

  57.         var nextDay = new Date(date);  

  58.         nextDay.setDate(nextDay.getMonthDays() + 1);  

  59.         if ((edd && nextDay > edd) || nextDay.getFullYear() > this.CONSTS.MAXYEAR) {  

  60.             table.$nextm.addClass('disabled').removeClass('hover').data('disabled'true);  

  61.         } else {  

  62.             table.$nextm.removeClass('disabled').data('disabled'false);  

  63.         }  

  64.         var prevDay = new Date(date);  

  65.         prevDay.setDate(0);  

  66.         if ((std && prevDay < std) || prevDay.getFullYear() < this.CONSTS.MINYEAR) {  

  67.             table.$prevm.addClass('disabled').removeClass('hover').data('disabled'true);  

  68.         } else {  

  69.             table.$prevm.removeClass('disabled').data('disabled'false);  

  70.         }  

  71.         date.setDate(1);  

  72.         var day1 = (date.getDay() - this.CONSTS.FIRSTDAY) % 7;  

  73.         date.setDate(0 - day1);  

  74.         date.setDate(date.getDate() + 1);  

  75.         var $frow = table.find('tbody').children().eq(0);  

  76.         for (var i = 0; i < 6; i++) {  

  77.             if (!$frow.length) {  

  78.                 break;  

  79.             }  

  80.             var $cell = $frow.children().eq(0);  

  81.             $cell.addClass('week wn').text(date.getWeekNumber());  

  82.             var iday;  

  83.             for (var j = 0; j < 7; ++j, date.setDate(iday + 1)) {  

  84.                 $cell = $cell.next();  

  85.                 $cell.removeClass().data('nav'this.CONSTS.NAV['day']);  

  86.                 if (!$cell.length) {  

  87.                     break;  

  88.                 }  

  89.                 iday = date.getDate();  

  90.                 $cell.text(iday);  

  91.                 var current_month = (date.getMonth() == month);  

  92.                 if (!current_month || j !=4 ) {  

  93.                     $cell.addClass('oday').data('disabled',true);  

  94.                     continue;  

  95.                 }  

  96.                 var disabled = false;  

  97.                 if ((std != null && std > date) || (edd != null && edd < date)) {  

  98.                     $cell.addClass('day disabled');  

  99.                     disabled = true;  

  100.                 } else {  

  101.                     $cell.addClass('day');  

  102.                 }  

  103.                 $cell.data('disabled', disabled);  

  104.                 if (!disabled) {  

  105.                     if (current_month && iday == day) {  

  106.                         this.cache.selectedDate && this.cache.selectedDate.removeClass('selected');  

  107.                         $cell.addClass('selected');  

  108.                         this.cache.selectedDate = $cell;  

  109.                         this.cache.showDay = iday;  

  110.                     }  

  111.                     if (date.getFullYear() == TY &&  

  112.                         date.getMonth() == TM &&  

  113.                         iday == TD) {  

  114.                         $cell.addClass('today');  

  115.                     }  

  116.                     var wday = date.getDay();  

  117.                     if ([06].indexOf(wday) != -1) {  

  118.                         $cell.addClass("weekend");  

  119.                     }  

  120.                 }  

  121.             }  

  122.             $frow = $frow.next();  

  123.         }  

  124.     }  

  125.     if (FR.Browser.isIE8() && this.$view.css('visibility') == 'hidden') {  

  126.         this.$view.css("visibility""visible");  

  127.     } else {  

  128.         this.$view.show();  

  129.     }  

  130.     $(document).bind('mousedown'thisthis.collapseIf);  

  131.     this.modifyPosition();  

  132.       

  133.       

  134.     var tr = $('tbody>tr',this.datepicker.$datetable);  

  135.     for( var i=0; i<tr.length; i++ ){  

  136.         var $days = $('td[class!="week wn"]',tr[i]);  

  137.         for( var j=0; j<$days.length; j++ ){  

  138.             var $day = $($days[j]);  

  139.             if4 != j && !$day.hasClass('oday')){  

  140.                 $day.data("disabled",true);  

  141.                 $day.attr('class','oday');  

  142.             }  

  143.         }  

  144.     }  

  145. }  

重点关注下面这段代码:

  1. var tr = $('tbody>tr',this.datepicker.$datetable);  

  2.     for( var i=0; i<tr.length; i++ ){  

  3.         var $days = $('td[class!="week wn"]',tr[i]);  

  4.         for( var j=0; j<$days.length; j++ ){  

  5.             var $day = $($days[j]);  

  6.             if4 != j && !$day.hasClass('oday')){  

  7.                 $day.data("disabled",true);  

  8.                 $day.attr('class','oday');  

  9.             }  

  10.         }  

  11.     }  


FineReport 18720859069 发布于 2019-4-28 19:47
1min目标场景问卷 立即参与
回答问题
悬赏:4 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
6
KerydiaLv5中级互助
发布于2019-4-29 08:27

ctrl+F  把4全部替换成3

最佳回答
0
yzm195551Lv2见习互助
发布于2021-11-14 16:49

谢谢

  • 3关注人数
  • 1139浏览人数
  • 最后回答于:2021-11-14 16:49
    请选择关闭问题的原因
    确定 取消
    返回顶部