jsp表格单击某行就把对应行的复选框选中,再点一下就取消,用jquery如何表示

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>floatDiv2.html</title>

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="this is my page">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">  
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript">
         $(function () {         
         $("tr").toggle(function () {
         $(this).find(":checkbox").attr("checked", true);
         }, function () {
         $(this).find(":checkbox").attr("checked", false);
         });
         });
        </script>
          </head>
      
      <body>
    <table>
    <tr>
    <td><input type="checkbox" /></td>
    <td align="right">
    参赛学生姓名:
    <td colspan="3">
    <input type="text" name="StuName" id="StuName" />
    </td>
    </tr>
    <tr>
    <td><input type="checkbox" /></td>
    <td align="right">
    学校名称:
    </td>
    <td colspan="3">
    <input type="text" name="SchoolName" id="SchoolName" />
    </td>
    </tr>
    <tr>
    <td><input type="checkbox" /></td>
    <td align="right">
    所在班级:
    </td>
    <td colspan="3">
    <input type="text" name="ClassName" id="ClassName" />
    </td>
    </tr>
    </table>
      </body>
    </html>