页面引入 bootstrap-datepicker.min.css bootstrap-datepicker.min.js bootstrap-datepicker.zh-CN.min.js 资源文件
<script language="javascript">
$(function(){
$("#newstimestart").attr("readonly", "true").datepicker({
format: "yyyy-mm-dd",
language: "zh-CN",
autoclose: true,
todayHighlight: true
});
$("#newstimeend").attr("readonly", "true").datepicker({
format: "yyyy-mm-dd",
language: "zh-CN",
autoclose: true,
todayHighlight: true
});
});
function dosearch(){
var start_date=$("#newstimestart").val();
var end_date=$("#newstimeend").val();
if(start_date!=""&&end_date!=""){
if(start_date>end_date){
alert("起始日期要小于结束日期");
return false;
}
}
$("#newseditform").submit();
}
</script>
<input type="text" class="form-control" id="newstimestart" name="newstimestart" value="${newslist.newstimestart!''}" placeholder="开始时间">
-
<input type="text" class="form-control" id="newstimeend" name="newstimeend" value="${newslist.newstimeend!''}" placeholder="结束时间">