Jquery快速制作双色表格

<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
    $(".strip tr").mousemove(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over")})
    $(".strip tr:even").addClass("alt");
});

</script>
<style type="text/css">
th{background:#0066FF;color:#FFFFFF;line-height:20px;height:30px;}
td{padding:6px 11px;border-bottom:1px solid #95bce2;vertical-align:top; text-align:center}
td*{padding:6px 11px;}
tr.alt td{background:#ecf6fc}
tr.over td{background:#bcd4ec}
</style>
</head>
<body>
<table class="strip" width="50%" border="0"  cellpadding="0"  cellspacing="0">
<thead>
    <tr>
        <th>姓名</th>
        <th>年龄</th>
        <th>QQ</th>
        <th>Email</th>
    </tr>
</thead>
<tbody>
<tr>
    <td>嘻嘻</td>
    <td>25</td>
    <td>34234</td>
    <td>[email protected]</td>
</tr>
<tr>
    <td>嘻嘻</td>
    <td>25</td>
    <td>34234</td>
    <td>[email protected]</td>
</tr>
<tr>
    <td>嘻嘻</td>
    <td>25</td>
    <td>34234</td>
    <td>[email protected]</td>
</tr><tr>
    <td>嘻嘻</td>
    <td>25</td>
    <td>34234</td>
    <td>[email protected]</td>
</tr><tr>
    <td>嘻嘻</td>
    <td>25</td>
    <td>34234</td>
    <td>[email protected]</td>
</tr>
</tbody>

</table>
</body>
</html>



你可能感兴趣的:(jquery)