Implement color-changing code instances for table table rows

Source: Internet
Author: User

Implement the color-changing code example for table table rows:
This section describes how to achieve the interlaced effect of table content, the effect is very extensive, because it has a high degree of practicality, and the implementation of the code is relatively simple, the following is a code example to explain how to achieve this effect.
The code is as follows:

<!DOCTYPE HTML> <HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Author"content= "http://www.softwhy.com/" /> <title>Table Thin Line tables-ant tribe</title> <styletype= "Text/css">#thetable{Background-color:Green;font-size:12px; }#thetable th{text-align:Center;Background-color:#CCF;Height:30px;Line-height:30px; }#thetable TD{width:150px;Height:30px;Line-height:30px;text-align:Center; } </style>  <Scripttype= "Text/javascript"src= "Mytest/jquery/jquery-1.8.3.js"></Script> <Scripttype= "Text/javascript">$ (document). Ready (function(){  $("tr:odd"). CSS ("Background-color","#eeeeee"); $("Tr:even"). CSS ("Background-color","#ffffff");})</Script> </Head>  <Body>  <Tablecellpadding= "0"cellspacing= "1"ID= "Thetable">   <TR>     <th>Title One</th>     <th>Title II</th>     <th>Title III</th>     <th>Title IV</th>   </TR>   <TR>     <TD>Ant Tribe One</TD>     <TD>Ant Tribe II</TD>     <TD>Ant Tribe Three</TD>     <TD>Ant Tribe Four</TD>   </TR>  <TR>     <TD>Ant Tribe One</TD>     <TD>Ant Tribe II</TD>     <TD>Ant Tribe Three</TD>     <TD>Ant Tribe Four</TD>   </TR>  <TR>     <TD>Ant Tribe One</TD>     <TD>Ant Tribe II</TD>     <TD>Ant Tribe Three</TD>     <TD>Ant Tribe Four</TD>   </TR>  <TR>     <TD>Ant Tribe One</TD>     <TD>Ant Tribe II</TD>     <TD>Ant Tribe Three</TD>     <TD>Ant Tribe Four</TD>   </TR>   <TR>     <TD>Ant Tribe One</TD>     <TD>Ant Tribe II</TD>     <TD>Ant Tribe Three</TD>     <TD>Ant Tribe Four</TD>   </TR> </Table> </Body>  </HTML>

The above code to achieve our requirements, to achieve the color effect of the line, the code is very simple, here is not more introduction, you can see the relevant reading.
Related reading:
1.: Odd selector can be found in jquery's: Odd selector section.
The 2.:even selector can be found in the section jquery: even selector .
The 3.css () function can be found in the section of the CSS () method of jquery .

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=14434

For more information, refer to: http://www.softwhy.com/jquery/

Implement color-changing code instances for table table rows

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.