• easyui月份插件如何监听


    <input class="timeInput" type="text" id="start" editable="false" class="easyui-datebox"/>
                                <span class="timeSpan">-</span>
                                <input class="timeInput" type="text" id="end" editable="false" class="easyui-datebox"/>
    $('#start').datebox({ 
            onShowPanel : function() {// 显示日趋选择对象后再触发弹出月份层的事件,初始化时没有生成月份层    
                span.trigger('click'); // 触发click事件弹出月份层    
                if (!tds)    
                    setTimeout(function() {// 延时触发获取月份对象,因为上面的事件触发和对象生成有时间间隔    
                        tds = p.find('div.calendar-menu-month-inner td');    
                        tds.click(function(e) { 
                           
                            e.stopPropagation(); // 禁止冒泡执行easyui给月份绑定的事件    
                            var year = /d{4}/.exec(span.html())[0]// 得到年份    
                            , month = parseInt($(this).attr('abbr'), 10) + 1, // 月份   
                            monthLm =  parseInt($(this).attr('abbr'), 10);
                            $('#start').datebox('hidePanel')// 隐藏日期对象    
                            .datebox('setValue', year + '-' + month); // 设置日期的值 
                  判断开始时间不能大于结束时间 if ($('#start').datebox("getValue")>$('#end').datebox("getValue")&&$('#end').datebox("getValue")!='') { $('#start').datebox("setValue",''); alert('开始不能大于结束'); }else{ if ($('#end').datebox("getValue")!=''&&$('#start').datebox("getValue")!='') { alert('请求数据') } } }); }, 0); }, parser : function(s) {// 配置parser,返回选择的日期 if (!s) return new Date(); var arr = s.split('-'); return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, 1); }, formatter : function(d) { var month = d.getMonth(); if(month
    <=10){ month = "0"+month; } if (d.getMonth() == 0) { return d.getFullYear()-1 + '-' + 12; } else { return d.getFullYear() + '-' + month; } }// 配置formatter,只返回年月 }); var p = $('#start').datebox('panel'), // 日期选择对象 tds = false, // 日期选择对象中月份 span = p.find('span.calendar-text'); // 显示月份层的触发控件
    $('#end').datebox({ 
            onShowPanel : function() {// 显示日趋选择对象后再触发弹出月份层的事件,初始化时没有生成月份层    
                span.trigger('click'); // 触发click事件弹出月份层    
                if (!tds)    
                    setTimeout(function() {// 延时触发获取月份对象,因为上面的事件触发和对象生成有时间间隔    
                        tds = p.find('div.calendar-menu-month-inner td');    
                        tds.click(function(e) { 
                           
                            e.stopPropagation(); // 禁止冒泡执行easyui给月份绑定的事件    
                            var year = /d{4}/.exec(span.html())[0]// 得到年份    
                            , month = parseInt($(this).attr('abbr'), 10) + 1, // 月份   
                            monthLm =  parseInt($(this).attr('abbr'), 10);
                            $('#end').datebox('hidePanel')// 隐藏日期对象    
                            .datebox('setValue', year + '-' + month); // 设置日期的值 
                  判断结束时间不能小于开始时间 if ($('#end').datebox("getValue")
    <$('#start').datebox("getValue")) { $('#end').datebox("setValue",''); alert('结束时间不能小于开始时间'); }else{ if ($('#end').datebox("getValue")!=''&&$('#start').datebox("getValue")!='') { alert('请求数据') } } }); }, 0); }, parser : function(s) {// 配置parser,返回选择的日期 if (!s) return new Date(); var arr = s.split('-'); return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, 1); }, formatter : function(d) { var month = d.getMonth(); if(month<=10){ month = "0"+month; } if (d.getMonth() == 0) { return d.getFullYear()-1 + '-' + 12; } else { return d.getFullYear() + '-' + month; } }// 配置formatter,只返回年月 }); var p = $('#end').datebox('panel'), // 日期选择对象 tds = false, // 日期选择对象中月份 span = p.find('span.calendar-text'); // 显示月份层的触发控件
  • 相关阅读:
    RFID Hacking②:PM3入门指南
    技术解析:锁屏绕过,三星Galaxy系列手机也能“被”呼出电话
    技术分享:逆向破解华为路由器第一部分
    GSM BTS Hacking: 利用BladeRF和开源BTS 5搭建基站
    js生成随即字符串
    ES6 对象解构
    vue隐藏APP启动时显示的{{}}
    国内常用的三种框架:ionic/mui/framework7对比
    vue for 绑定事件
    html5视频全频播放
  • 原文地址:https://www.cnblogs.com/SunShineM/p/9059746.html
Copyright © 2020-2023  润新知