无刷新模糊搜索表格数据
XML/HTML Code
- <div class="content">
- 无刷新搜索<input type="text" id="lin" placeholder="请输入需要搜索的内容">
- <table id="table-1" cellspacing='0' border="1" style="text-align: center;">
- <tr>
- <th>姓名</th>
- <th>性别</th>
- <th>年龄</th>
- <th>电话</th>
- <th>地址</th>
- </tr>
- <tr>
- <td>赵一</td>
- <td>男</td>
- <td>28</td>
- <td>1234567891</td>
- <td>上海</td>
- </tr>
- <tr>
- <td>钱二</td>
- <td>女</td>
- <td>28</td>
- <td>1234567892</td>
- <td>北京</td>
- </tr>
- <tr>
- <td>孙三</td>
- <td>女</td>
- <td>25</td>
- <td>1234567893</td>
- <td>广州</td>
- </tr>
- <tr>
- <td>李四</td>
- <td>女</td>
- <td>26</td>
- <td>1234567894</td>
- <td>深圳</td>
- </tr>
- </table>
- </div>
JavaScript Code
- <script type="text/javascript">
- var table = document.getElementById("table-1");
- var input = document.getElementById("lin")
- input.onkeyup = function () {
- new Search(table, input)
- }
- </script>
原文地址:http://www.freejs.net/article_jquerywenzi_922.html