开发者

Date Picker in javascript that will not accept past and current date

Here's my code:

<script type="text/javascript" src="calendar_date_picker.js"></script>
<script type="text/javascript">
  var cdp1 = new CalendarDatePicker();
  var props = {
    debug :         true,
    excludeDays :       [6,0,1],
    excludeDates :      ['20081225','20081226','20091225','20091226'],
    minimumFutureDate : 5,
    formatDate :        '%m-%d-%y'
  };
  var cdp2 = new CalendarDatePicker(props);
  props.formatDate = '%d-%m-%y';
  var cdp3 = new CalendarDatePicker(props);
  cdp3.endYear = cdp3.startYear + 1;
  var开发者_StackOverflow cdp4 = new CalendarDatePicker(props);
  cdp4.addDisabledDatas("new Date =< new Date");
</script>


Try:

 var props = {
    debug :         true,
    excludeDays :       [6,0,1],
    excludeDates :      ['20081225','20081226','20091225','20091226'],
    minimumFutureDate : [5, false],
    formatDate :        '%m-%d-%y'
    };

From the documentation:

minimumDate - dates before this date are not selectable. format: yyyymmdd
maximumDate - dates after this date are not selectable. format: yyyymmdd
minimumFutureDate - same as minimum date but defined as an offset on the current date. must be set as an array of which the second argument indicates whether excluded days should be considered as well

http://devshed.excudo.net/scripts/javascript/source/calendar+date+picker


Also have a look at this page: http://devshed.excudo.net/scripts/javascript/calendar_date_picker_help.php

It contains a list of all the properties you can modify. The startYear property might also be of interest to you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜