<!DOCTYPE html> <html> <head> <title>test</title> <script src="jquery-3.1.1.min.js"> </script> <script> $(document).ready(function(){ $("tr:even").css("background-color","yellow"); }); </script> </head> <body> <h1>InJavaWeTrust</h1> <table border="1"> <tr> <th>网站名</th> <th>网址</th> </tr> <tr> <td>Google</td> <td>http://www.google.com</td> </tr> <tr> <td>Baidu</td> <td>http://www.baidu.com</td> </tr> <tr> <td>菜鸟教程</td> <td>http://www.runoob.com</td> </tr> <tr> <td>淘宝</td> <td>http://www.taobao.com</td> </tr> <tr> <td>Facebook</td> <td>http://www.facebook.com</td> </tr> </table> </body> </html>
jQuery 选择器 选取偶数位置的 <tr> 元素
猜你喜欢
转载自injavawetrust.iteye.com/blog/2323454
今日推荐
周排行