jquery-implemented table table interlaced color code example

Source: Internet
Author: User

jquery implementation of table table interlaced color code example:
The following is a code example, to achieve the effect of interlaced color, which is one of the site humanized measures, in the practical application of the use of a very wide.
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; }. Even{background:#FFF38F;}. Odd{background:#FFFFEE;}. Selected{background:#FF9900;}</style>  <Scripttype= "Text/javascript"src= "Mytest/jquery/jquery-1.8.3.js"></Script> <Scripttype= "Text/javascript"> $(function(){   $("#thetable tr:odd"). addclass ("Odd"); $("#thetable Tr:even"). addclass ("even"); }); </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 the effect of interlaced color, the code is relatively simple here is not much introduction, you can see the relevant reading.
Related reading:
1.: Odd selector can be found in jquery's: Odd selector section.
The 2.addClass () function can be found in the AddClass () method section of jquery .

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

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

jquery-implemented table table interlaced color code example

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.