Jquery implementation list (line by line color, select all, move the mouse over the current line) effect example _ jquery

Source: Internet
Author: User
Jquery implementation list (line by line color, select all, move the mouse over the current line). For more information, see [javascript].

The Code is as follows:


$ (Function (){
Gridview ("GridView1 ");
});

// Gridview
Function gridview (objgridview ){
// Get obj id
Var gridviewId = "#" + objgridview;
// Even
$ (GridviewId + "> tbody tr: even"). addClass ("NormalColor ");
// First
$ (GridviewId + "> tbody tr: first"). removeClass ("NormalColor"). addClass ("HeadColor ");
// Odd
$ (GridviewId + "> tbody tr: odd"). addClass ("AlterColor ");
// Move and click
$ (GridviewId + "> tbody tr"). slice (1). hover (function (){
$ (This). addClass ("HoverColor ");
}, Function (){
$ (This). removeClass ("HoverColor ");
});
// All check
$ ("# ChkAll"). click (function (){
$ (GridviewId + '> tbody> tr> td> input: checkbox'). attr ('checked', this. checked );
});
// Check status
$ (GridviewId + '> tbody> tr> td> input: checkbox'). click (function (){
Var expr1 = gridviewId + '> tbody> tr> td> input: checkbox: checked ';
Var expr2 = gridviewId + '> tbody> tr> td> input: checkbox ';
Var selectAll = $ (expr1). length = $ (expr2). length;
$ ('# Chkall'). attr ('checked', selectAll );
});
}


[Html]

The Code is as follows:





Lt; HeaderTemplate>

Lt;/HeaderTemplate>






[Css]

The Code is as follows:


. HeadColor {background-color: # E0ECFF; color: #333; line-height: 25px ;}
. AlterColor {background-color: # edf1f8; line-height: 20px ;}
. NormalColor {background-color: # f7f6f3; line-height: 20px ;}
. HoverColor {background: #89A5D1; line-height: 20px ;}
. SelectColor {background-color: # ACBFDF; line-height: 20px ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.