Home > Web Front-end > JS Tutorial > body text

How to use layui front-end framework date control

小云云
Release: 2018-01-11 17:06:54
Original
3654 people have browsed it

This article mainly introduces in detail how to use the date control in the layui front-end framework. It has a certain reference value. Interested friends can refer to it. I hope it can help everyone.

The example in this article shares the implementation code of layui-date control for your reference. The specific content is as follows


##

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>日期</title>
  <link rel="stylesheet" href="layui/css/layui.css">
 </head>
 <body>
  <blockquote class="layui-elem-quote">目前Layui中的日期组件还是layDate 1.1的改良版,它后续将会进行一次重写。</blockquote>
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
   <legend>顺便列举几个常用例子</legend>
  </fieldset>
  <p class="layui-form-pane" style="margin-top: 15px;">
   <p class="layui-form-item">
  <label class="layui-form-label">范围选择</label>
  <p class="layui-input-inline">
   <input class="layui-input" placeholder="开始日" id="LAY_demorange_s">
  </p>
  <p class="layui-input-inline">
   <input class="layui-input" placeholder="截止日" id="LAY_demorange_e">
  </p>
  </p>
  </p>

  <script src="layui/layui.js"></script>
  <script>
layui.use(&#39;laydate&#39;, function(){

 var laydate = layui.laydate;

 var start = {
 min: laydate.now()
 ,max: &#39;2099-06-16 23:59:59&#39;
 ,istoday: false
 ,choose: function(datas){
  end.min = datas; //开始日选好后,重置结束日的最小日期
  end.start = datas //将结束日的初始值设定为开始日
 }
 };

 var end = {
 min: laydate.now()
 ,max: &#39;2099-06-16 23:59:59&#39;
 ,istoday: false
 ,choose: function(datas){
  start.max = datas; //结束日选好后,重置开始日的最大日期
 }
 };

 document.getElementById(&#39;LAY_demorange_s&#39;).onclick = function(){
 start.elem = this;
 laydate(start);
 }
 document.getElementById(&#39;LAY_demorange_e&#39;).onclick = function(){
 end.elem = this
 laydate(end);
 }

});
</script>

 </body>
</html>
Copy after login

Rendering:

Related recommendations:

jquery method to obtain the value of easyui date control

JavaScript implemented date control

A simple horizontal javascript date control_time and date

The above is the detailed content of How to use layui front-end framework date control. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template