<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>