Select a row in the repeater table to change the color of the repeater table.

Source: Internet
Author: User

Select a row in the repeater table to change the color of the repeater table.

// Click a row in the table, and the color of the selected row will change to light blue (the color can be set by yourself)

// Where sellerTable is the table id,
$ ("# SellerTable tbody tr"). mousedown (function (){
$ ("# SellerTable tr"). each (function (){
Certificate (this).css ("background-color ","");
});
Certificate (this).css ("background-color", "#98D8F5 ");
});

// Bind a button event to the foreground (traverse the color in the table. The color of each row is compared with the color of the header. The selected line is the one with different colors)

$ ("# BtnDelete"). click (function (){
Var sellerCD = "";
$ ('# SellerTable tr'). each (function (){
If (((this).css ("background-color ")! = $ ("Th" ).css ("background-color ")){
SellerCD = $ (this). find ("td"). eq (0). text (); // set sellerCD as the value of the first column
Return false;
}
});
If (sellerCD = null | sellerCD = undefined | sellerCD = ""){
Alert. ");
} Else {

// Send data upon page Jump. You can obtain the data on the SellersDetail page, for example, sellerCD = Request. QueryString ["sellerCD"];

Window. location. href = "SellersDetail. aspx? Type = delete & sellerCD = "+ sellerCD;
}
})

 

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.