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