php结合js实现多条件组合查询
网络编程 2021-07-04 15:50www.168986.cn编程入门
这篇文章主要为大家详细介绍了php结合js实现多条件组合查询,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
一、效果图
二、前端代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Jquery分类</title> <script src="http://libs.baidu./jquery/1.7.2/jquery.min.js"></script> <style type="text/css"> .templinkactive { padding:5px; text-decoration:none; color:red; } .templink { cursor:pointer; padding:5px; text-decoration:none; } table{border:1px solid #c;} table tr{ height:35px;} </style> <script type="text/javascript"> $(function () { //品牌 var alink01 = $("#linktype01").find("span"); alink01.click(function () { alink01.each(function () { $(this).removeClass("templinkactive").addClass("templink"); }); $(this).removeClass("templink").addClass("templinkactive"); $("#Brand").val($(this).attr("tag")); SetPara(); }); //价格 var alink02 = $("#linktype02").find("span"); alink02.click(function () { alink02.each(function () { $(this).removeClass("templinkactive").addClass("templink"); }); $(this).removeClass("templink").addClass("templinkactive"); $("#Price").val($(this).attr("tag")); SetPara(); }) //尺寸 var alink03 = $("#linktype03").find("span"); alink03.click(function () { alink03.each(function () { $(this).removeClass("templinkactive").addClass("templink"); }); $(this).removeClass("templink").addClass("templinkactive"); $("#Size").val($(this).attr("tag")); SetPara(); }); }); function SetPara() { var Brand = $("#Brand").val(); var Price = $("#Price").val(); var Size = $("#Size").val(); alert("1.php?Brand=" + Brand + "&Price=" + Price + "&Size=" + Size); // var keywords = $("#search").val(); // var skip_url = "http://" + window.location.hostname + window.location.pathname; // var url = skip_url + "?s=/admin/goods/goods_list/Brand/"+Brand+"/Price/"+Price+"/Size/"+Size; // window.location.href = url; // alert(url); }; </script> <script type="text/javascript"> ///TP框架-start $(function(){ var Brand = $("#Brand").val(); var Price = $("#Price").val(); var Size = $("#Size").val(); // alert(tag); if(Brand != ''){ $("#linktype01").find("span").removeClass("templinkactive").addClass("templink") $('span[tag="'+Brand+'"]').css('color','red'); } if(Price != ''){ $("#linktype02").find("span").removeClass("templinkactive").addClass("templink") $('span[tag="'+Price+'"]').css('color','red'); } if(Size != ''){ $("#linktype03").find("span").removeClass("templinkactive").addClass("templink") $('span[tag="'+Size+'"]').css('color','red'); } }); //TP框架-end/ </script> </head> <body> <form id="form1" runat="server"> <div> <table> <tr id="linktype01"> <td style="width:100px"> <b>笔记本品牌</b> </td> <td> <span class='templinkactive' tag="0">不限</span> </td> <td> <span class='templink' tag="100101">联想(Lenovo)</span> </td> <td> <span class='templink' tag="100102">宏碁(Acer)</span> </td> <td> <span class='templink' tag="100103">华硕(ASUS)</span> </td> <td> <span class='templink' tag="100104">戴尔(DELL)</span> </td> <td> <span class='templink' tag="100105">苹果(Apple)</span> </td> <td> <span class='templink' tag="100106">三星 (SAMSUNG)</span> </td> </tr> <tr id="linktype02"> <td style="width:100px"> <b>价格范围</b> </td> <td> <span class='templinkactive' tag="0">不限</span> </td> <td> <span class='templink' tag="100201">1000-2999</span> </td> <td> <span class='templink' tag="100202">3000-3499</span> </td> <td> <span class='templink' tag="100203">4000-4499</span> </td> <td> <span class='templink' tag="100204">5000-5999</span> </td> <td> <span class='templink' tag="100205">6000-6999</span> </td> <td> <span class='templink' tag="100206">7000及以上</span> </td> </tr> <tr id="linktype03"> <td style="width:100px"> <b>尺寸范围</b> </td> <td> <span class='templinkactive' tag="0" >不限</span> </td> <td> <span class='templink' tag="100301">8.9英寸及以下</span> </td> <td> <span class='templink' tag="100302">11英寸</span> </td> <td> <span class='templink' tag="100303">12英寸</span> </td> <td> <span class='templink' tag="100304">13英寸</span> </td> <td> <span class='templink' tag="100305">14英寸</span> </td> <td> <span class='templink' tag="100306">15英寸及以上</span> <input type="hidden" id="Brand" value="" /> <input type="hidden" id="Price" value="" /> <input type="hidden" id="Size" value="" /> </td> </tr> </table> </div> </form> </body> </html>
三、服务端代码
goodsController.class.php
<?php public function goods_list(){ $Brand= I('Brand'); $Price= I('Price'); $Size= I('Size'); $this->assign('Brand',$Brand); $this->assign('Price',$Price); $this->assign('Size',$Size); $this->display(); } ?>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持狼蚁SEO。
编程语言
- 宿迁百度关键词排名指南:实现精准营销的关键
- 四川SEO优化怎么做网络推广
- 立昂技术备案老域名收购:如何为您的业务赋能
- 安徽百度关键词seo贵不贵,一般需要多少钱
- 吉林百度快照排名怎么做电话营销
- 多伦新手做SEO怎么做
- 甘肃优化关键词排名推广怎么做论坛营销
- 沙雅SEO网站推广:提升您的在线可见性
- 四川SEO优化如何提升销售额和销售量
- 聂荣网站排名优化:提升网站可见性的全方位指
- 涞水SEO:提升地方企业在线可见性的策略
- 辽宁百度seo排名怎样做网站排名
- 临湘哪有关键词排名优化:提升网站可见度的关
- 黑龙江百度网站优化有没有优惠
- 凉城优化关键词排名推广:提升您的网络可见性
- 萝北整站优化:提升您网站流量和排名的全面指