<script type="text/javascript" src="/url/datepicker-init.js"></script>
<tr>
<td class="project-font" width="11.5%">计划上线日期范围:</td>
<td width="11.5%">
<div class="input-project" style="z-index:15;height:27px;">
<input type="text" class="input-pro-input pickdate date0" id="onlineStartTime" name="onlineStartTime" readonly=readonly/>
</div>
</td>
<td width="11.5%" align="center">--</td>
<td width="11.5%">
<div class="input-project" style="z-index:15;height:27px;">
<input type="text" class="input-pro-input pickdate date0" id="onlineEndTime" name="onlineEndTime" readonly=readonly/>
</div>
</td>
</tr>
//绑定计划上线日期范围
function bindStartEndTime(start,end){
$(start).datepicker({selectOtherMonths: true, dateFormat: 'yy-mm-dd',
onClose: function(dateText, inst) {
if ($(end).val() != '') {
checkTimeValidate($(start),$(end),'start');
}
}
});
$(end).datepicker({selectOtherMonths: true, dateFormat: 'yy-mm-dd',
onClose: function(dateText, inst) {
if ($(start).val() != '') {
checkTimeValidate($(start),$(end),'end');
}
}
});
}
/*验证两个日期*/
function checkTimeValidate(start,end,operateItem){
var currentItem;
if(operateItem == 'start'){
currentItem = start;
}else if(operateItem == 'end'){
currentItem = end;
}
var testStartDate = $(start).val();
var testEndDate = $(end).val();
/*验证开始时间不能晚于结束时间*/
if (testStartDate != '' && testEndDate!='' && testStartDate > testEndDate){
currentItem.val('');
popMsg('error',"开始时间不能晚于结束时间",undefined,-1);
}
}
//绑定计划开始结束日期
bindStartEndTime($("#onlineStartTime"),$("#onlineEndTime"));
时间控件
最新推荐文章于 2024-02-24 14:29:26 发布