js 日期控件laydate使用

官网  http://sentsin.com/layui/laydate/

1. 下载官网上的压缩包,解压后只需要复制laydate 文件夹到你的项目中;

2. 在页面引入  <script type="text/javascript" src="js/laydate/laydate.js"></script>

3. 在页面添加: 

<div class="inline layinput">
<input placeholder="YYYY-MM-DD hh:mm:ss" onclick="laydate({istime: true, format: 'YYYY-MM-DD '})">
<label class="laydate-icon"></label>
</div>

4. 设置回调函数;

复制代码
<input name="beginDate" value='<s:property value="#beginDate"/>'  class="diyige beginDate" onclick="laydate({choose:beginDateCallBack})"> 
- 
<input name="endDate" value='<s:property value="#endDate"/>' class="diyige endDate" onclick="laydate({choose:endDateCallBack})"> 
                        
复制代码
function beginDateCallBack(){
    //定义获取到日期后的操作...
};
posted @ 2016-05-19 12:38  山上小和尚  阅读(2655)  评论(0编辑  收藏  举报