亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JQuery表格內(nèi)容過濾的實現(xiàn)方法

 更新時間:2013年07月05日 17:33:50   作者:  
使用JQuery 實現(xiàn)一個表格內(nèi)容 過濾的功能,有需要的朋友可以參考一下,代碼如下:
復(fù)制代碼 代碼如下:

[html]
<!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>JQuery表格內(nèi)容過濾</title>
<style type="text/css">
table{ border:0;border-collapse:collapse;}
div{font:normal 12px/17px Arial;}
td{ font:normal 12px/17px Arial;padding:2px;width:100px;}
th{ font:bold 12px/17px Arial;text-align:left;padding:4px;border-bottom:1px solid #333;width:100px;}
.even{ background:#FFF38F;}  /* 偶數(shù)行樣式*/
.odd{ background:#FFFFEE;}   /* 奇數(shù)行樣式*/
.selected{ background:#FF6500;color:#fff;}
</style>
<!--   引入jQuery -->
<script src="jquery-1.5.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(function(){
       $("#filterName").keyup(function(){
          $("table tbody tr")
                    .hide()
                    .filter(":contains('"+( $(this).val() )+"')")
                    .show();
       }).keyup();
  })
</script>
</head>
<body>
    <div> <br/> 篩選: <input id="filterName" name="filterName" /> <br/> </div>
    <table>
        <thead>
            <tr><th>姓名</th><th>性別</th><th>暫住地</th></tr>
        </thead>
        <tbody>
            <tr><td>SYJ</td><td>男</td><td>河北秦皇島市</td></tr>
            <tr><td>李四</td><td>女</td><td>北京北京市</td></tr>
            <tr><td>王五</td><td>男</td><td>河北秦皇島市</td></tr>
            <tr><td>趙六</td><td>男</td><td>河北唐山市</td></tr>
            <tr><td>張三</td><td>男</td><td>內(nèi)蒙古呼和浩特市</td></tr>
            <tr><td>王六</td><td>女</td><td>內(nèi)蒙古包頭市</td></tr>
            <tr><td>二狗</td><td>男</td><td>北京北京市</td></tr>
            <tr><td>李字</td><td>女</td><td>河北秦皇島市</td></tr>
            <tr><td>二蛋</td><td>男</td><td>東北遼寧省</td></tr>
        </tbody>
    </table>
</body>
</html>

相關(guān)文章

最新評論