Jquery-table Zebra Crossing

Source: Internet
Author: User

Html

<link href= "Stylesheet.css" rel= "StyleSheet" type= "Text/css"/>
<script src= "Jquery.js" type= "Text/javascript" ></script>
<script src= "Javascript.js" type= "Text/javascript" ></script>
<title> Zebra crossing </title>
<body>
<div id= "Bodydiv" >
<table cellspacing= "0" >
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>lost in the plot</td>
<td>the dears</td>
</tr>
<tr>
<td>2</td>
<td>Poison</td>
<td>the constantines</td>
</tr>
<tr>
<td>3</td>
<td>plea from A Cat Named virtute</td>
<td>the weakerthans</td>
</tr>
<tr>
<td>4</td>
<td>melissa louise</td>
<td>Chixdiggit!</td>
</tr>
<tr>
<td>5</td>
<td>living room</td>
<td>tegan and Sara</td>
</tr>
<tr>
<td>6</td>
<td>Speed</td>
<td>bran Van 3000</td>
</tr>
<tr>
<td>7</td>
<td>fast Money blessing</td>
<td>king Cobb steelie</td>
</tr>
<tr>
<td>8</td>
<td>Sore</td>
<td>buck 65</td>
</tr>
<tr>
<td>9</td>
<td>love travel</td>
<td>danko jones</td>
</tr>
<tr>
<td>10</td>
<td>you never let Me down</td>
<td>Furnaceface</td>
</tr>
</tbody>
</table>
</div>
</body>

CSS (STYLESHEET.CSS)

Body
{
width:100%;
height:100%;
Margin:auto;
Text-align:center;
}
#bodydiv
{
height:100%;
}

Table
{
width:100%;
}

JS (Jquery.js)

$ (function () {
Tr:eq (0) refers to the first TR eq=equal
TR:GT (0) means all TR Gt=grater except the first one than
$ ("Tr:eq (0)"). CSS ("Background-color", "#8888ff"); Style of the title
$ ("tr:gt (0): even"). CSS ("Background-color", "#ffffcc"); The style of odd lines
$ ("tr:gt (0): Odd"). CSS ("Background-color", "#ccccff"); Style of even lines
$ ("tr:gt (0)"). MouseEnter (function () {
var color = $ (this). CSS ("Background-color");
$ (this). CSS ("Background-color", "#5555ff");
$ (this). MouseLeave (function () {
$ (this). CSS ("Background-color", color);
});
$ (this). MouseDown (function () {
$ (this). CSS ("Background-color", "#2222ff");
});
$ (this). MouseUp (function () {
$ (this). CSS ("Background-color", "#5555ff");
});
});
});

Ref:http://www.cnblogs.com/lxblog/archive/2013/01/11/2856582.html

Jquery-table Zebra Crossing

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.