3

我试图用 jquery 从两个日历中获取两个日期
我该怎么做。
编码 :

 <div id="checklinkform" data-role="fieldcontain">
                    <label for="checkin">Date début :</label></td>
                         <input name="checkin" id="checkin" data-role="datebox" type="date" data-mini="true"
                                 data-options='{"closeCallback":"linkedCheckin", "noButton": false, "closeCallbackArgs":["checkin"], "mode": "calbox", "focusMode": true, "centerWindow": true, "afterToday": false, "beforeToday":true}'>

                        <input name="checkin_monthday" type="hidden" size="2" id="checkin_monthday" data-mini="true"/>
                        <input name="checkin_year_month" type="hidden" size="7" id="checkin_year_month" data-mini="true"/>

                    <label for="checkout">Date fin :</label></td>   
                        <input name="checkout" id="checkout" data-role="datebox" type="date" data-mini="true"
                                data-options='{"calHighToday":false, "closeCallback":"linkedCheckin", "noButton": false, "closeCallbackArgs":["checkout"], "mode": "calbox", "focusMode": true, "centerWindow": true}'>

                       <input name="checkout_monthday" type="hidden" size="2" id="checkout_monthday" data-mini="true"/>
                       <input name="checkout_year_month" type="hidden" size="7" id="checkout_year_month" data-mini="true"/>

             </div>

编辑。

这是我使用的 cheklinkform 函数:

linkedCheckin = function (date, name) {
    // The widget itself
var self     = this,
    // The day after whatever just got set
      nextday  = date.copymod([0,0,1]);
    // Today
    today    = new Date();
    // The difference of today and whatever got set (secs)
    diff     = parseInt((date - today) / ( 1000 * 60 * 60 * 24 ),10);
    // The same difference, in days (+2)
    diffstrt = (diff * -1)-2;

// Lets fill in the other fields.
$('#'+name+'_year_month').val(self._formatter('%Y-%m', date));
$('#'+name+'_monthday').val(self._formatter('%d', date));
// Update the seen output
$('#checkoutput').text($('#checklinkform input').serialize());

// If we edited the checkin date, more work to do
if ( name === "checkin" ) {
  // Ok, so in steps: (nuke the comments)
  // Set the (internal) checkout date to be whatever was picking in checkin +1 day
  $('#checkout').data('datebox').theDate = nextday;
  // Show that to the user
  $('#checkout').trigger('datebox', {'method':'doset'});
  // Make sure that minDays won't let them check out same day or earlier
  $('#checkout').datebox({"minDays": diffstrt});
  // Open it up
  $('#checkout').datebox('open');
}
}

我想获得 2 日期以使用另一个功能发送它们

4

1 回答 1

0

演示是你要找的东西让我知道 - 点击这里

如果这不对,请发表评论,我将删除我的帖子。

更新

代码

alert(" Date Check in: " + $("#checkin").val());
    alert(" Date Check out: " + $("#checkout").val());
于 2012-05-22T09:14:39.117 回答