<link rel="stylesheet" href="<%=path%>/layui/css/layui.css" type="text/css"></link> <script type="text/javascript" src="<%=path%>/layui/layui.js"></script> <script> layui.use('laydate', function() { var laydate = layui.laydate; var start = { min : laydate.now(), max : '2099-06-16 23:59:59', istoday : false, choose : function(datas) { end.min = datas; //开始日选好后,重置结束日的最小日期 end.start = datas; //将结束日的初始值设定为开始日 } }; var end = { min : laydate.now(), max : '2099-06-16 23:59:59', istoday : false, choose : function(datas) { start.max = datas; //结束日选好后,重置开始日的最大日期 } }; document.getElementById('LAY_demorange_s').onclick = function() { start.elem = this; laydate(start); } document.getElementById('LAY_demorange_e').onclick = function() { end.elem = this laydate(end); } }); </script> </head> <body> <p> 入职时间:<input placeholder="入职时间" onclick="layui.laydate({elem: this, festival: true})" name="entrydate" /> </p> </body>