<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>表格内容筛选</title>
<script language="JavaScript" src="js/jquery-1.11.1.min.js"></script>
</head>
<body>
<table width="260" border="1" align="center">
<thead align="center" valign="bottom">
<tr>
<td colspan="2">搜索:<input type="text" name="keyword" id="keyword"/></td>
</tr>
<tr bgcolor="#90EE90">
<td>姓名</td>
<td>成绩</td>
</tr>
</thead>
<tbody align="center" bgcolor="#FFFF88">
<tr>
<td>王帅</td>
<td>97</td>
</tr>
<tr>
<td>李雷</td>
<td>92</td>
</tr>
<tr>
<td>高天</td>
<td>97</td>
</tr>
<tr>
<td>赵卫</td>
<td>87</td>
</tr>
<tr>
<td>王强</td>
<td>97</td>
</tr>
<tr>
<td>陈美</td>
<td>88</td>
</tr>
</tbody>
</table>
<script>
$(function(){
$("#keyword").keyup(function(){
if($("#keyword").val()!=''){
$("table tbady tr").hide().filter(":contains('"+($(this).val())+"')").show();
}
})
})
</script>
</body>
</html>
【第六章】表格内容筛选
最新推荐文章于 2022-02-23 17:34:42 发布