需要在Javascript或Jquery中使用日历脚本,该脚本应该具有禁用当前日期所有先前日期的选项,并且还禁用星期六和星期日
答案 0 :(得分:1)
您可以使用 jquery ui datepicker
minDate
和maxDate
选项答案 1 :(得分:0)
以下是javascript中非常简单的日历脚本:
<table border="1">
<tr>
<td>M</td> <td>T</td> <td>W</td> <td>T</td> <td>F</td> <td>S</td> <td>S</td>
</tr>
<script language="JavaScript"> <!--
// find the first day of the current month
function firstDay() {
d = new Date(); // d is today's date
d.setDate(1); // set d to the 1st of this month
day = d.getDay(); // day of week - 0=Sunday, 1=Monday... etc.
if (day==0) {
return 6;
} else {
return day-1;
}
}
var week = 0; // week of the month
var weekDay = 0; // day of the week
var day; // day of the month
var startingDay = firstDay(); // day the month starts, 0 to 6
for (week=0; week<=5; week++) {
document.write("<tr>");
for (weekDay=1; weekDay<=7; weekDay++) {
document.write("<td>");
day = 7*week+weekDay;
day -= startingDay;
if (day>0 && day<=31) { document.write(day); }
document.write("</td>");
}
document.write("</tr>");
}
--> </script>
<table>
它没有禁用过去的日期或周末,但它很简单,你可能会适应它。