时间:2021-01-14 11:14:54 | 栏目:JavaScript代码 | 点击:次
1.在页面先引入laydate.js文件
2.html页面控件如下:
<input name="begin_time" style="margin-top:8px;width:130px;" id="begin_time" value="${beginTime}" class="Wdate" type="text"/> <input name="deadline_time" style="margin-top:8px;width:130px;" id="deadline_time" value="${deadlineTime}" class="Wdate" type="text"/>
3.html页面js代码如下:
//年月选择器 laydate.render({ elem: '#begin_time' ,type: 'month' ,min: '${minBeginTime}-29' ,max: '${maxBeginTime}-29' ,done: function(value){ $("#deadline_time").remove(); $("#myd").append('<input name="deadline_time" style="margin-top:8px;width:130px;" id="deadline_time" class="Wdate" type="text"/>'); $("#deadline_time").val(value); $.ajax({ url:'reportYearMonth/getMaxMinEndTime.json', data:{minTime:value}, type:'post', dataType:'json', success:function(data){ laydate.render({ elem: '#deadline_time' ,type: 'month' ,min:data.minEndTime+'-29' ,max:data.maxEndTime+'-29' }); } }); } });