• 表格文本框搜索匹配


    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>表格展开和关闭</title>
    <script src="jquery-1.4.2.js"></script>
    <script type="text/javascript">
    $(function(){

    $("tbody>tr.parent").addClass("even");
    $("tr.parent").click(function(){
    $(this).toggleClass("selected")
    .siblings(".child_"+this.id).toggle();
    });

    // $("tr:contains('王五')").addClass("selected");

    // $("table tbody tr").hide().filter(":contains('李')").show();

    $("#filtername").keyup(function(){
    $("table tbody tr").hide().filter(":contains('"+$(this).val()+"')").show();
    }).keyup();

    });
    </script>
    <style>
    .odd{background:#eee;}
    .even{background:#999;}
    .selected{background:red;}
    </style>

    </head>

    <body>

    搜索:<input type="text" id="filtername">
    <table border="1" cellpadding="0" cellspacing="0" width="100%">
    <thead>
    <tr>
    <th width="30%">姓名</th><th width="30%">性别</th><th width="40%">暂住地</th>
    </tr>
    </thead>
    <tbody>
    <tr class="parent" id="row_01">
    <td colspan="3">前台设计组</td>
    </tr>
    <tr class="child_row_01">
    <td>张三</td><td>男</td><td>浙江宁波</td>
    </tr>
    <tr class="child_row_01">
    <td>李四</td><td>女</td><td>浙江杭州</td>
    </tr>
    <tr class="parent" id="row_02">
    <td colspan="3">前台开发组</td>
    </tr>
    <tr class="child_row_02">
    <td>王五</td><td>男</td><td>湖南长沙</td>
    </tr>
    <tr class="child_row_02">
    <td>赵六</td><td>女</td><td>湖南耒阳</td>
    </tr>
    <tr class="parent" id="row_03">
    <td colspan="3">后台开发组</td>
    </tr>
    <tr class="child_row_03">
    <td>谢七</td><td>男</td><td>上海</td>
    </tr>
    <tr class="child_row_03">
    <td>李八</td><td>女</td><td>北京</td>
    </tr>
    </tbody>
    </table>

    </body>
    </html>

  • 相关阅读:
    python10.31
    python10.29
    python10.28
    python10.27
    python10.25
    python10.24
    python10.23
    四边形不等式与决策单调
    0x57~0x59
    0x55~0x56
  • 原文地址:https://www.cnblogs.com/ll-taj/p/5825354.html
Copyright © 2020-2023  润新知