PHP+MYSQL+JQUERY实现内容的筛选或实时搜索
这是本人做的一个通讯录实例。可实时查找
<?php include ("menu.php"); include ("head.php"); ?> <!-- 引入jQuery --> <script src="jquery-1.7.2.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> <table align="center" width="80%" bgcolor="#000000" cellspacing="1"> <caption> 通讯录 <input id="filterName" type="text" autofocus/> <a href="outputexcel/tongxunlu.php"><img src="images/excel.jpg" class="t2"></a> </caption> <thead> <tr> <th width="15%">账号</th> <th width="10%">姓名</th> <th width="18%">手机</th> <th width="15%">电话</th> <th width="15%">科室</th> <th width="12%">级别</th> <th width="15%">编号</th></tr> </thead> <tbody> <?php $sqlgroups="select * from user order by jibie"; $resultgroups=mysql_query($sqlgroups); $numrows=mysql_num_rows($resultgroups); if ($numrows>0) { while($data=mysql_fetch_array($resultgroups)) { ?> <tr align="center" class="hx"> <td><?php echo $data["username"];?></td> <td><?php echo $data["realname"];?></td> <td><?php echo $data["mobile"];?></td> <td><?php echo $data["bgdh"];?></td> <td><?php echo $data["keshi"];?></td> <td><?php echo $data["jibie"];?></td> <td><?php echo $data["bianhao"];?></td> </tr> <?php } }?> </tbody> </table> <?php require("foot.php"); ?>
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。