解决方案 »

  1.   

    div  class="username"  这个 div 显示或者隐藏是不?
      

  2.   

    $(':checkbox').change(function(){$('div.username')[this.checked?'show':'hide']()})
      

  3.   

    这个table不止一行,有很多行这样的,到我只想让选中的当前这行的样式显示或隐藏
      

  4.   

    这个table不止一行,有很多行这样的,到我只想让选中的当前这行的样式显示或隐藏
    $(':checkbox').change(function(){$(this).parents('tr').find('div.username')[this.checked?'show':'hide']()})
      

  5.   

    <script src=scripts/jquery-1.8.3.min.js></script>
    <script>
    $(function() {
      $('.user_resource .username').hide();
      $('.user_resource :checkbox').click(function() {
        if($(this).prop('checked')) $(this).parents('tr').find('.username').show();
        else $(this).parents('tr').find('.username').hide();
      });
    })
    </script>
    <div class="user_resource">
    <table width="100%" >
         <tr height="90px">
            <td width="7%" align="center">
                <input type="checkbox"/>
            </td>
            <td width="30%" align="center">人力资源管理系统</td>
            <td width="19%" align="center">
                <img src="images/13.png">       
            </td>
            <td width="44%" align="center">
                <div class="username">用户名:<input type="text" name="appUserName" id="appUserName"/></div>
            </td>
          </tr>
     </table>         
      </div>
      

  6.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style>
    .username{ border:#F00 1px solid; width:200px; height:300px;}
    </style>
    </head>
    <body>
    <script src="jquery-1.9.0.js"></script>
    <script>
    $(function(){
      $(':checkbox').click(function(){
        if($(this).prop('checked')){ 
    $(this).parents('tr').find("div").addClass("username");
    }else{
           $(this).parents('tr').find("div").removeClass("username");
    }
      });
    })
    </script>
    <div class="user_resource">
    <table width="100%" >
         <tr height="90px">
            <td width="7%" align="center">
                <input type="checkbox"/>
            </td>
            <td width="30%" align="center">人力资源管理系统</td>
            <td width="19%" align="center">
                <img src="images/13.png">       
            </td>
            <td width="44%" align="center">
                <div>用户名:<input type="text" name="appUserName" id="appUserName"/></div>
            </td>
          </tr>
    </table>         
    </div>
    </body>
    </html>
      

  7.   

    $(function() {
      $('.user_resource .username').hide();
      $('.user_resource :checkbox').click(function() {
        if($(this).prop('checked')) $(this).parents('tr').find('.username').show();
        else {
          $(this).parents('tr').find('.username').hide();
          $(this).parents('tr').find('#appUserName').val('');
        }
      });
    })