By admin, 16 二月, 2015

 
function css(a) {
    var sheets = document.styleSheets, o = {};
    for (var i in sheets) {
        var rules = sheets[i].rules || sheets[i].cssRules;
        for (var r in rules) {
            if (a.is(rules[r].selectorText)) {
                o = $.extend(o, css2json(rules[r].style), css2json(a.attr('style')));
            }
        }

标签

By admin, 16 二月, 2015

tr:nth-child(even) { background-color: #000000; }

以上方法不适用于IE8及以下版本。

也可用通过jQuery的方法实现:

$(document).ready(function() {

  $("tr:even").css("background-color", "#000000");

});

标签

By admin, 16 二月, 2015

 
function css(a) {
    var sheets = document.styleSheets, o = {};
    for (var i in sheets) {
        var rules = sheets[i].rules || sheets[i].cssRules;
        for (var r in rules) {
            if (a.is(rules[r].selectorText)) {
                o = $.extend(o, css2json(rules[r].style), css2json(a.attr('style')));
            }
        }

标签

最新评论