6.15ajax House Selection

Source: Internet
Author: User

<! DOCTYPE html>sousuo{Width:100px; Height:30px; Background-color:#117a8b;Border-radius:3px; Text-align:Center; Line-height:30px; Color:White ; }        . Sousuo:hover{Cursor:pointer; }    </style>Area:<label><input type= "checkbox" onclick= "qx1 (This)" > select all </label><br/> <label ><inpu T type= "checkbox" Name= ""class= "QY" value= "Boshan"/> Boshan </label> <input type= "checkbox" Name= ""class= "QY" value= "Yiyuan"/>Yiyuan<input type= "checkbox" Name= ""class= "QY" value= "Huantai"/>Huantai<input type= "checkbox" Name= ""class= "QY" value= "Beijing"/>Beijing<input type= "checkbox" Name= ""class= "QY" value= "Shanghai"/>Shanghai<input type= "checkbox" Name= ""class= "QY" value= "Nanjing"/> Nanjing <br/>type of leasing:<input type= "checkbox" onclick= "qx2 (This)"/> Select all <br/> <input type= "checkbox" Name= ""class= "ZL" Value= "co-rental"/>co-rental<input type= "checkbox" Name= ""class= "ZL" value= "full rent"/> Full <br/>type of house:<input type= "checkbox" onclick= "qx3 (This)"/> Select all <br/> <input type= "checkbox" Name= ""class= "FW" value= "3 Room 1 Hall"/>3 Room 1 Hall<input type= "checkbox" Name= ""class= "FW" value= "Cottage"/>Bungalow<input type= "checkbox" Name= ""class= "FW" value= "2 Room 1 Hall"/>2 Room 1 Hall<input type= "checkbox" Name= ""class= "FW" value= "Tongzilou"/>Tongzilou<input type= "checkbox" Name= ""class= "FW" value= "1 Room 1 Hall"/>1 Room 1 Hall<input type= "checkbox" Name= ""class= "FW" value= "4 Room 2 Hall"/>4 Room 2 Hall <br/>Key Words:<input type= "text" name= "" id= "GJZ" value= ""/> <divclass= "Sousuo" onclick= "Sousuo ()" > Search </div> <table border= "1" cellspacing= "0" cellpadding= "0"class= "Table table-bordered" > </table></body>vartab = document.getElementsByTagName ("table") [0]; varQY = Document.getelementsbyclassname ("qy"); varZL = Document.getelementsbyclassname ("ZL"); varFW = Document.getelementsbyclassname ("FW"); //LoadData (",", ",", ");//Load pageSousuo (); functionLoadData (Tt,condition,condition1,condition2) {        $.Ajax ({type: "Post",URL: "Zlcl.php",Async:true,Data:{                "Type": "Chazhao", "NM": TT, "condition": Condition, "condition1": Condition1, "Condition2":Condition2},DataType: "JSON",Success:function(data) {varstr = ""; varstr = "<td> serial numbers </td><td> keywords </td><td> area </td><td> area </td><td> rent </td><td> Rental Type </td><td> housing type </td> ";  for(varI=0;i<data.length; i++) {str+ = "<tr>";  for(varj=0;j<data[i].length;j++){            //If you check all fields without judging if (j = = 1) {str + = "<td>" +data[i][j].replace (TT, "<span style= ' color:red; ') > "+tt+" </span> "+" </td> "; //}else{//str + = "<td>" +data[i][j]+ "</td>"; //}} str+ = "</tr>"; } tab. InnerHTML =str;        }        }); }    functionSousuo () {varCondition = ' '; varQuyu = $ (". Qy");  for(vari=0;i<quyu.length;i++){            if(quyu[i].checked = =true) {Condition+ = ' quyu= ' ' +$ (Quyu[i]). val () + ' "or '; }} Condition= condition.substr(0,condition.length-2); //===================        varCondition1 = ' '; varZulin = $ (". Zl");  for(varj=0;j<zulin.length;j++){            if(zulin[j].checked = =true) {Condition1+ = ' zulinlx= ' ' +$ (Zulin[j]). val () + ' "or '; }} condition1= Condition1.substr(0,condition1.length-2); //======================        varCondition2 = ' '; varFangwu = $ (". FW"));  for(vark=0;k<fangwu.length;k++){            if(fangwu[k].checked = =true) {Condition2+ = ' fangwlx= ' ' +$ (Fangwu[k]). val () + ' "or '; }} condition2= Condition2.substr(0,condition2.length-2); varGJZ = document.getElementById ("GJZ").value; LoadData (GJZ, Condition,condition1,condition2); }            functionqx1 (t) { for(vari=0;i<qy.length;i++){            if(T.checked) {Qy[i]. checked=true; }Else{Qy[i]. checked=false; }        }            }     functionqx2 (t) { for(vari=0;i<zl.length;i++){            if(T.checked) {Zl[i]. checked=true; }Else{Zl[i]. checked=false; }        }            }     functionqx3 (t) { for(vari=0;i<fw.length;i++){            if(T.checked) {Fw[i]. checked=true; }Else{Fw[i]. checked=false; }        }            }</script>

Home

<?PHP$type=$_post[' Type ']; $conn=NewMysqli ("localhost", "root", "" "," Ceshi "); $conn->connect_error? die("Link Failed"): ""; Switch($type){        Case"Chazhao":$nm=$_post[' NM ']; $condition=$_post[' Condition ']; $condition 1=$_post[' Condition1 ']; $condition 2=$_post[' Condition2 ']; $condit= ' 1=1 '; if($nm! = "){                 $condit. = "and (name like '%{$nm}% ' or Quyu like '%{$nm}%‘) "; }             if($condition! = "){                 $condit. = ' and ('.$condition.‘)‘; //quyu= "Yiyuan" select * from Fwzl where ' 1=1 ' and (name like '%{$nm}% ' or Quyu like '%{$nm}% ') and quyu= "Yiyuan "             }             if($condition 1! = "){                 $condit. = ' and ('.$condition 1.‘)‘; }             if($condition 2! = "){                 $condit. = ' and ('.$condition 2.‘)‘; }             $sql= "SELECT * from Fwzl where$condit"; $result=$conn->query ($sql); $attr=$result-Fetch_all (); EchoJson_encode ($attr);  Break; }?>

PHP page

Regional:Select All
BoshanYiyuanHuantaiBeijingShanghaiNanjing
Type of Leasing:Select All
Co-rentalFull rent
Type of House:Select All
3 Room 1 HallCottage2 Room 1 HallTongzilou1 Room 1 Hall4 Room 2 Hall
Key words:

Search

Serial number Key words Regional Area Rent Type of Leasing Type of House
1 Huantai Spare Boshan 100 1000 Full rent 3 Room 1 Hall
2 Yiyuan Large maternity ward Yiyuan 150 1599 Co-rental Cottage
3 Next to the Huantai Trail Huantai 200 500 Co-rental 2 Room 1 Hall
4 Yiyuan Large maternity ward Zhangdian 110 1200 Full rent Tongzilou
5 Next to the Huantai Trail Beijing 80 2000 Co-rental 4 Room 2 Hall
6 Boshan Spare Shanghai 90 3000 Full rent 1 Room 1 Hall
7 Boshan Spare Nanjing 300 5000 Co-rental Tongzilou

6.15ajax House Selection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.