$(document).ready(function() {
$(".trbg").click(function(){
$(this).next("tr").show(500)
});
});<table  class="tabletype" >
<tr class="trbg" >
             <td colspan="7">可能保养用户回访</td>
        </tr>
    <tr style="display:none"  id="MaymaintainTr">
<td colspan='7' >数据加载中...</td>
     </tr>
</table><table  class="tabletype" >
<tr class="trbg" >
             <td colspan="7">生日用户回访</td>
        </tr>
    <tr style="display:none"  id="MaymaintainTr">
<td colspan='7' >数据加载中...</td>
     </tr>
</table>
<table  class="tabletype" >
<tr class="trbg" >
             <td colspan="7">未接触用户回访</td>
        </tr>
    <tr style="display:none"  id="MaymaintainTr">
<td colspan='7' >数据加载中...</td>
     </tr>
</table>
我想做的是,点击当前的行,隐藏其他的行。求解

解决方案 »

  1.   

    $(".trbg").click( function() {
    var $this=$(this);
    $(".trbg").hide();
    $this.show();
    });
      

  2.   

    $(document).ready(function() {
                $(".trbg").click(function(){
                        $(".trbg").hide();
                        $(this).show(500);
    // 不会这样吧?
                });
    });
      

  3.   


    <script>
            $(document).ready(function () {
                $(".trbg").click(function () {
                    $(".trbg").hide(500);
                    $(this).show(500);
                    $(this).next("tr").show(500);
                    
                });
            });    </script>
      

  4.   

    $(".trbg").click( function() {
    $(".trbg").siblings().hide();//同一table的tr
    $(this).show();
    });
      

  5.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="ec/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $(".trbg").click(function () {
                    $(this).hide().siblings().show();
                });
            });
        </script>
    </head>
    <body>
        <table class="tabletype">
            <tr class="trbg">
                <td colspan="7">
                    可能保养用户回访
                </td>
            </tr>
            <tr style="display: none" id="MaymaintainTr">
                <td colspan='7'>
                    数据加载中...
                </td>
            </tr>
        </table>
        <table class="tabletype">
            <tr class="trbg">
                <td colspan="7">
                    生日用户回访
                </td>
            </tr>
            <tr style="display: none" id="MaymaintainTr">
                <td colspan='7'>
                    数据加载中...
                </td>
            </tr>
        </table>
        <table class="tabletype">
            <tr class="trbg">
                <td colspan="7">
                    未接触用户回访
                </td>
            </tr>
            <tr style="display: none" id="MaymaintainTr">
                <td colspan='7'>
                    数据加载中...
                </td>
            </tr>
        </table>
    </body>
    </html>亲测可运行。