看板 Web_Design 關於我們 聯絡資訊
※ 引述《adamp3 (Boston's 10th Man.)》之銘言: : 請問除了用<td class = "even">text</td>以外 : 有沒有辦法用javascript去跑 : 讓表格每隔一行的顏色會不同 : 如下 : col col2 : row1 text text : row2 text text : row3 text text : row4 text text : 請高手解答! : 最近弄表格弄到快瘋了 囧 要不要試試jQuery :) 先定義style : <style> .oddTr{ background-color:#999999; } </style> 再加個jQuery的ready事件 : <script language="javascript"> $().ready(function(){ $('tr:odd').addClass('oddTr'); //在奇數列掛上.oddTr這個style }); </script> 底下table隨便做 : <table border="1" width="300"> <tr> <td>1111</td> </tr> <tr> <td>2222</td> </tr> <tr> <td>3333</td> </tr> <tr> <td>4444</td> </tr> </table> 收工,希望有幫上忙 :) -- http://blog.eddie.com.tw/ http://www.eddie.com.tw/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.128.37
aquarianboy:喔,別忘了去下載jquery的js回來include進去 :) 04/30 09:58