今天日期和未来 2 天不显示周末 - 显示在选择选项



我可以请求检查关于如何在选择下拉列表中禁用/不显示周末的代码吗?

<select style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#000;" name="address3" id="date-range" data-field-type="Text">
<option value="" selected="selected">Select date</option>
</select>
<script>
var dateRange = document.getElementById('date-range'),
monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
for(var day = 2; day < 120; day++) {
var date = new Date();

date.setDate(date.getDate() + day);
dateRange.options[dateRange.options.length] = new Option(
[date.getDate(), monthNames[date.getMonth()], date.getFullYear()].join(' '), date.toISOString()
);
}
</script>

var dateRange = document.getElementById('date-range'),
monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
for(var day = 3; day < 120; day++) {
var date = new Date();
date.setDate(date.getDate() + day);
if(!(date.getDay()==6|| date.getDay()==0))
dateRange.options[dateRange.options.length] = new Option([date.getDate(), monthNames[date.getMonth()], date.getFullYear()].join(' '), date.toISOString());
}
<select style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#000;" name="address3" id="date-range" data-field-type="Text">
<option value="" selected="selected">Select date</option>
</select>

相关内容

  • 没有找到相关文章

最新更新