A small plug-in based on jQuery that is used to change the color of the line and move the mouse to change the color. For more information about jquery, see. Table HTMLElement Effect
The Code is as follows:
Var br_cc = (function (){
Var setEffect = function (els, params ){
Var settings = {"c1": "# eee", "c2": "# ccc", "c3": "# f00 "};
$. Extend (settings, params );
Els. each (function (I ){
Var self = $ (this );
If (I % 2 = 0 ){
This. _ bg = settings. c1;
} Else {
This. _ bg = settings. c2;
}
Self.css ({"background-color": this. _ bg, "cursor": "pointer "});
Self. mouseover (function (){
Self.css ("background-color", settings. c3 );
});
Self. mouseout (function (){
Self.css ("background-color", this. _ bg );
});
});
};
Var cc_table = function (params ){
Params = params || {};
Var box = params. box? $ ("#" + Params. box): $ ("body"). eq (0 );
SetEffect (box. find ("tr "));
};
Var cc_p = function (params ){
Params = params || {};
Var box = params. box? $ ("#" + Params. box): $ ("body"). eq (0 );
Var els = params. tagClass? Box. find ("." + settings. tagClass): box. find ("p ");
SetEffect (els );
};
Return {"cc_tb": cc_table, "cc_p": cc_p };
})();
$ (Document). ready (function (){
Br_cc.cc_tb ({"box": "stu-datas-tb "});
Br_cc.cc_p ({"box": "stu-datas-p "});
});
It is very simple to use, so there will be no nonsense. If you need it, you can directly use it. Don't forget TOHA.
The data of table and p indicates the Html structure:
The Code is as follows:
Table HTMLElement Effect
Id |
Name |
Age |
Sex |
1 |
Zhang San |
18 |
Male |
1 |
Zhang San |
18 |
Male |
1 |
Zhang San |
18 |
Male |
1 |
Zhang San |
18 |
Male |
P HTMLElement Effect
1 Li Qian, 20 female
1 Li Qian, 20 female
1 Li Qian, 20 female
1 Li Qian, 20 female