日期:2014-05-16 浏览次数:20360 次
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <script src="jquery-mobile/jquery-1.6.4.min.js"></script> <script type="text/javascript"> $(document).ready(function(e) { $(".show").nextUntil(".show").css("display","none"); $(".show").click(function(){ $(this).nextUntil(".show").toggle(); }); }); </script> <style type="text/css"> .show{background:#F0F;} </style> </head> <body> <table width="500px" border="1" cellpadding="0" cellspacing="0"> <tr class="show"><td>fsdfsd</td><td>dfsdgf</td><td>dgdfhfgf</td></tr> <tr><td>fsdfsd</td><td>dfsdgf</td><td>dgdfhfgf</td></tr> <tr><td>fsdfsd</td><td>dfsdgf</td><td>dgdfhfgf</td></tr> <tr class="show"><td>fsdfsd</td><td>dfsdgf</td><td>dgdfhfgf</td></tr> <tr><td>fsdfsd</td><td>dfsdgf</td><td>dgdfhfgf</td></tr> <tr><td>fsdfsd</td><td>dfsdgf</td><td>dgdfhfgf</td></tr> </table> </body> </html>
$(function(e) { $("table tr:not(.show)").hide(); $(".show").click(function(){ $("table tr:not(.show)").hide(); $(this).nextUntil(".show").toggle(); }); });