이 코드를 사용하고 있지만 datepicker에서 날짜를 선택할 수 없습니다. 왜? 내가 몇 달을 바꿀 때 날짜를 선택할 수 있습니다. 나는 disableFunc
을 사용하여 다음 3 일 및 일요일을 캘린더에서 비활성화합니다. 그것을 제거하면 disableFunc
날짜를 선택할 수 있습니다. 어떤 해결책?JavaScript에서 날짜를 선택할 수 없습니다.
Calendar.setup({
inputField : '_dob',
ifFormat : '%m/%e/%y',
button : '_dob_trig',
align : 'Bl',
singleClick : true,
disableFunc: function(date)
{
var first_day = new Date();
var second_day= new Date();
var third_day= new Date();
first_day.setDate(first_day.getDate());
if(first_day.getDay()===0)
{
first_day.setDate(first_day.getDate()+1);
}
second_day.setDate(first_day.getDate()+1);
if(second_day.getDay()===0)
{
second_day.setDate(first_day.getDate()+2);
}
third_day.setDate(second_day.getDate()+1);
if(third_day.getDay()===0)
{
third_day.setDate(second_day.getDate()+2);
}
var flag1 = first_day.getDate()===date.getDate() && first_day.getMonth()===date.getMonth() && first_day.getYear()===date.getYear();
var flag2 = second_day.getDate()===date.getDate() && second_day.getMonth()===date.getMonth() && second_day.getYear()===date.getYear();
var flag3 = third_day.getDate()===date.getDate() && third_day.getMonth()===date.getMonth() && third_day.getYear()===date.getYear();
if(date.getDay() === 0 || flag1 || flag2 || flag3)
{ return true; }
}
});
줄 단위로 문제를 해결하는 경우 예기치 않은 동작을 일으키는 줄은 무엇입니까? – roland
'return true;'는 예기치 않은 동작을 유발하지만 그 이유는 무엇입니까? – HungryDB