首页 > 技术文章 > 个人日常笔记

weiloong 2015-10-12 11:41 原文

1. datebox设置默认时间
$(document).ready(function() {    
         $("#start").datebox("setValue",myformatter( new Date()));
         $("#end").datebox("setValue",myformatter( new Date()));
         /* $(".datebox :text").attr("readonly","readonly"); */
    });

    function myformatter(date){  
        var y = date.getFullYear();  
        var m = date.getMonth()+1;  
        var d = date.getDate();  
        return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);  
    }

2.easyui input设置为日期 class="easyui-datebox"

class="easyui-datetimebox"  带时分秒

 

3.easyui input标签动态变成下拉框

供货商:<input type="text" id="from_customer_id" style="width:70px;height:20px;" />
    $('#from_customer_id').combobox({   
                  url:'${ctx}/admin/repo_tool/listSelect',   
                  valueField:'id',   
                  textField:'customername',
                  panelHeight:'100',
                  editable:false,
            });    
    Controller方法加头:@RequestMapping("/listSelect")
                        @ResponseBody        

    如果想获取下拉框的值  用这个:  .combobox("getValue");

4. 背景图为灰色

background-color:rgb(235, 235, 228)"

5. 输入框去空格

onkeyup="value=value.replace(/\s/g,'')"

6. 输入框只能输入数字以及去空格

onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')"

7. 边框为灰色,背景也为灰色

style='background-color:#ccc;border-bottom:2px solid #ccc'

8. jquery 获取easyui combobox选中的值

$('#comboboxlist').combobox('getValue');

 9.EasyUI combotree 赋值

$('#{$namespace}menu_id').combotree('setValues', '{$menu_id}'); 

 

推荐阅读