easyui设置datebox默认当前日期,且只能选择当前日期之前的日期

来源:互联网 发布:淘宝外贸原单鞋店 编辑:程序博客网 时间:2024/06/05 15:57

html代码:

<li><span class="label">计划运行日期</span><input name="" id="planRunDt" class="easyui-datebox" data-options="editable:false"></li>
js代码:

$('#planRunDt').datebox('setValue', getCurentDateStr());$('#planRunDt').datebox('calendar').calendar({validator : function(date){var now = new Date();var d1 = new Date(now.getFullYear(),now.getMonth(),now.getDate());return date <= d1;}});function getCurentDateStr(){ var now = new Date();    var year = now.getFullYear();       //年    var month = now.getMonth() + 1;     //月    var day = now.getDate();            //日    var clock = year + "-";    if(month < 10) clock += "0";           clock += month + "-";    if(day < 10) clock += "0";     clock += day;    return clock; }

效果:





0 0
原创粉丝点击