当前位置:编程学习 > JAVA >>

推荐个比较好用的日期选择框组件 选择 时间范围 CustomPeriodUI

做成一个小按钮,点一下出现如下一个小弹框

 

可以选择日期时间

源码

[javascript] 
var avg_fdate="",avg_tdate="",selperiod=console.constants.HRS12,fdate="",tdate=""; 
   var avg_button=new Ext.Button({ 
       icon: '/ico/date.png', 
       cls: 'x-btn-icon', 
       tooltip: { 
           text:_('<b>Select time range</b><br/>')  
       }, 
       handler:function(){ 
           var avg=new CustomPeriodUI(_("Select time range"),fdate,tdate,selperiod); 
           var avg_window = avg.getWindow(); 
           var btn= new Ext.Button({ 
               id:'avg_button', 
               text: _('OK'), 
               listeners: { 
                   click: function(btn) { 
                       if(avg.validate()){ 
                           avg_window.hide(); www.zzzyk.com
                           avg_fdate=avg.fromTime(); 
                           avg_tdate=avg.toTime(); 
                        fdate1 = formatDate(new Date(avg_fdate));//日期格式的转换 
                        tdate1 = formatDate(new Date(avg_tdate)); 
                       } 
                   } 
               } 
           }); 
           avg_window.addButton(btn); 
           avg_window.show(); 
       } 
   }); 
很简单吧

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,