1

我无法在结帐输入框中添加 +1day...这是我的代码,如果我在检查时选择一个日期,y 只会在结帐时自动获得相同的日期,我找不到错误,我尝试了一些选项。我修改了 onselect 函数,但我无法得到我想要的结果......只有 JavaScript 的错误和错误......

<script>
$(function() {
$('#checkin').bind('focus',function(){
      $('#ui-datepicker-div').css('visibility','visible');
});
$('#checkin').datepicker({
  numberOfMonths: 1,
  minDate: 0,
  onClose: function(dateText, inst) {
      var endDateTextBox = $('#checkout');
      if (endDateTextBox.val() != '') {
          var testStartDate = new Date(dateText);
          var testEndDate = new Date(endDateTextBox.val());
          if (testStartDate > testEndDate)

              endDateTextBox.val(dateText);
      }
      else {
          endDateTextBox.val(dateText);
      }
  },
  onSelect: function (selectedDateTime){
      var start = $(this).datetimepicker('getDate');
      $('#checkout').datetimepicker('option', 'minDate', new Date(start.getTime()));
      $('#ui-datepicker-div').css('visibility','visible');
  }
});

});
$('#checkout').datepicker({
  numberOfMonths: 1,
  minDate: 0,
  onClose: function(dateText, inst) {
      var startDateTextBox = $('#checkin');
      if (startDateTextBox.val() != '') {
          var testStartDate = new Date(startDateTextBox.val());
          var testEndDate = new Date(dateText);
          if (testStartDate > testEndDate)
              startDateTextBox.val(dateText);
      }
      else {
          startDateTextBox.val(dateText);
      }
  },
  onSelect: function (selectedDateTime){
      var end = $(this).datetimepicker('getDate');
      $('#checkin').datetimepicker('option', 'maxDate', new Date(end.getTime()) );
              refresh_subtotal();

  }
});
</script>
4

0 回答 0