jQuery 抄袭笔记(16) : 表格
18 Oct 2011当鼠标移动到表格上,呈现黑色状态。
01 <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
02 <html xmlns=“http://www.w3.org/1999/xhtml”>
03 </span>
04 <meta http-equiv=“Content-Type” content=“text/html; charset=gb2312″ />
05</span>Hello Lazynight!</title>
06 <script src=“http://www.cssrain.cn/demo/jquery.js” type=“text/javascript”></script>
07 <script type=“text/javascript”>
08 $(document).ready(function(){
09 $(“.lazy_table tr”).mouseover(function(){
10 $(this).addClass(“over”);}).mouseout(function(){
11 $(this).removeClass(“over”);})
12 $(“.lazy_table tr:even”).addClass(“lazy”);
13 });
14 </script>
15
16 th {
17 background-color:#000;
18 color:#fff;
19 height:30px;
20 }
21 td {
22 padding:5px 10px;
23 text-align:center;
24 }
25 tr.lazy td {
26 background-color:#bb3355;
27 color:#fff;
28 }
29 tr.over td {
30 background-color:#000;
31 color:#fff;
32 }
33
34 </head>
35 </span>
36 <table class=“lazy_table” width=“50%” border=“0″ cellspacing=“0″ cellpadding=“0″>
37 </span>
38</span>
39</span>曲名</th>
40 </span>歌手</th>
41 </span>专辑</th>
42 </span>风格</th>
43 </tr>
44 </thead>
45 </span>
46</span>
47</span>曲名</td>
48 </span>歌手</td>
49 </span>专辑</td>
50 </span>风格</td>
51 </tr>
52</span>
53</span>曲名</td>
54 </span>歌手</td>
55 </span>专辑</td>
56 </span>风格</td>
57 </tr>
58</span>
59</span>曲名</td>
60 </span>歌手</td>
61 </span>专辑</td>
62 </span>风格</td>
63 </tr>
64</span>
65</span>曲名</td>
66 </span>歌手</td>
67 </span>专辑</td>
68 </span>风格</td>
69 </tr>
70</span>
71</span>曲名</td>
72 </span>歌手</td>
73 </span>专辑</td>
74 </span>风格</td>
75 </tr>
76</span>
77</span>曲名</td>
78 </span>歌手</td>
79 </span>专辑</td>
80 </span>风格</td>
81 </tr>
82</span>
83</span>曲名</td>
84 </span>歌手</td>
85 </span>专辑</td>
86 </span>风格</td>
87 </tr>
88 </tbody>
89 </table>
90 </body>
91 </html> </div> 下载源码 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(16) : 表格][2] [1]: http://lazynight.me [2]: http://lazynight.me/551.html
02 <html xmlns=“http://www.w3.org/1999/xhtml”>
03 </span>
04 <meta http-equiv=“Content-Type” content=“text/html; charset=gb2312″ />
05
06 <script src=“http://www.cssrain.cn/demo/jquery.js” type=“text/javascript”></script>
07 <script type=“text/javascript”>
08 $(document).ready(function(){
09 $(“.lazy_table tr”).mouseover(function(){
10 $(this).addClass(“over”);}).mouseout(function(){
11 $(this).removeClass(“over”);})
12 $(“.lazy_table tr:even”).addClass(“lazy”);
13 });
14 </script>
15
16 th {
17 background-color:#000;
18 color:#fff;
19 height:30px;
20 }
21 td {
22 padding:5px 10px;
23 text-align:center;
24 }
25 tr.lazy td {
26 background-color:#bb3355;
27 color:#fff;
28 }
29 tr.over td {
30 background-color:#000;
31 color:#fff;
32 }
33
34 </head>
35 </span>
36 <table class=“lazy_table” width=“50%” border=“0″ cellspacing=“0″ cellpadding=“0″>
37 </span>
38
39
40
41
42
43 </tr>
44 </thead>
45 </span>
46
47
48
49
50
51 </tr>
52
53
54
55
56
57 </tr>
58
59
60
61
62
63 </tr>
64
65
66
67
68
69 </tr>
70
71
72
73
74
75 </tr>
76
77
78
79
80
81 </tr>
82
83
84
85
86
87 </tr>
88 </tbody>
89 </table>
90 </body>
91 </html> </div> 下载源码 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(16) : 表格][2] [1]: http://lazynight.me [2]: http://lazynight.me/551.html