前端问题和解决方法



Centering text in column
th.dt-center, td.dt-center { text-align: center; }


Change table header color using bootstrap
thead th {
    background-color: #006DCC;
    color: white;
}


tbody td {
    background-color: #EEEEEE;
}


change select default color
::selection {
  background: #ffb7b7; /* WebKit/Blink Browsers */
}
::-moz-selection {
  background: #ffb7b7; /* Gecko Browsers */
}


.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
    background-color: red; /*you color here*/
    background-image: none;
}


获取当前时间和日期:
var currentdate = new Date(); 
var datetime = "Last Sync: " + currentdate.getDate() + "/"
                + (currentdate.getMonth()+1)  + "/" 
                + currentdate.getFullYear() + " @ "  
                + currentdate.getHours() + ":"  
                + currentdate.getMinutes() + ":" 
                + currentdate.getSeconds();

function getDateTime() {
    var now     = new Date(); 
    var year    = now.getFullYear();
    var month   = now.getMonth()+1; 
    var day     = now.getDate();
    var hour    = now.getHours();
    var minute  = now.getMinutes();
    var second  = now.getSeconds(); 
    if(month.toString().length == 1) {
        var month = '0'+month;
    }
    if(day.toString().length == 1) {
        var day = '0'+day;
    }   
    if(hour.toString().length == 1) {
        var hour = '0'+hour;
    }
    if(minute.toString().length == 1) {
        var minute = '0'+minute;
    }
    if(second.toString().length == 1) {
        var second = '0'+second;
    }   
    var dateTime = year+'/'+month+'/'+day+' '+hour+':'+minute+':'+second;   
     return dateTime;
}


JQuery的live()方法已经被废除,使用on(event, handler())方法替换
$("#curPage").live('change',function(){  }); 


解决第一个option的change事件无法触发的问题
给设置一个option,然后给该option设置成默认选择selected,然后把它隐藏,具体如下:
<option style="display:none" selected>默认选择</option>
展开阅读全文

没有更多推荐了,返回首页