Home >Web Front-end >JS Tutorial >javascript jQuery-based table hover discoloration/restoration, table click discoloration/restoration, click row selection Checkbox_jquery

javascript jQuery-based table hover discoloration/restoration, table click discoloration/restoration, click row selection Checkbox_jquery

WBOY
WBOYOriginal
2016-05-16 19:01:571526browse

// Version: 1.0
// Date: 2007/08/01
// Note: Requires jQuery library
// Reference: Dodo(tableRowCheckboxToggle) and softcomplex(tigra_tables)

function Kin_Tables(
                                                                                                                                        Kin_Table_GetTableMethod, //The method of getting Table is the same as the $() function                                                                                                      Kin_Table_Footer_Offset, //How many rows can be ignored from now on Optional parameters
Kin_Table_Odd_Style, //Odd row style Optional parameter
Kin_Table_Even_Style, //Even row style Optional parameter
Kin_Table_Hover_Style, //Mouse hover style optional parameters
                                                                              Style Optional Parameters thod?Kin_Table_GetTableMethod:".Kin_Table");
Kin_Table_Config.Header_Offset=(!isNaN(Kin_Table_Header_Offset)?Kin_Table_Header_Offset:0);
Kin_Table_Config.Footer_Offset=(!isNaN(Kin_Table_Footer_Offset)?Kin_Table_Footer_O ffset:0);
Kin_Table_Config.Odd_Style=(Kin_Table_Odd_Style?Kin_Table_Odd_Style:"odd ");
Kin_Table_Config.Even_Style=(Kin_Table_Even_Style?Kin_Table_Even_Style:"even");
Kin_Table_Config.Hover_Style=(Kin_Table_Hover_Style?Kin_Table_Hover_Style:"over");
Kin_Table_Config.Click_Style=(Kin_Table_Click_Style?Kin_Table_Click_Style:" clicked");

var Kin_Table = $(Kin_Table_Config.GetTableMethod " tr:nth-child(n " eval(Kin_Table_Config.Header_Offset 1) ")");

Kin_Table.each(function (i,row){
                                                                                                                                    bChecked = false ;
$(row).addClass(i%2==0?Kin_Table_Config.Odd_Style:Kin_Table_Config.Even_Style)
$(row).hover(
function(){$(this).addClass( Kin_Table_Config.Hover_Style);},
                                                                                                                 🎜>              $ (this).toggleClass(Kin_Table_Config.Click_Style); 🎜>             });
});
            Kin_Table_Row_Checkbox.each(function(){
                if(this.checked){
                    bChecked = true;
                    return false;
                }
            });
            if (bChecked) {
                $(row).addClass(Kin_Table_Config.Click_Style);
                Kin_Table_Row_Checkbox.each(function(){
                    this.checked = true;
                });
            }else{
                $(row).removeClass(Kin_Table_Config.Click_Style);
            }
        });
    });
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn