如果我有一个月的2月,我怎样才能让下面的代码工作?目前它已经到了那天,然后在到达if之前停下来确定它是否是闰年.
if (month == 2) {
if (day == 29) {
if (year % 4 != 0 || year % 100 == 0 && year % 400 != 0) {
field.focus();
field.value = month +'/' + '';
}
}
else if (day > 28) {
field.focus();
field.value = month +'/' + '';
}
}
Run Code Online (Sandbox Code Playgroud)