script src ="Jq/jquery-1.4.2.js" type ="text/javascript" /script
創(chuàng)新互聯(lián)科技有限公司專業(yè)互聯(lián)網(wǎng)基礎(chǔ)服務(wù)商,為您提供托管服務(wù)器,高防服務(wù)器租用,成都IDC機(jī)房托管,成都主機(jī)托管等互聯(lián)網(wǎng)服務(wù)。
script type ="text/javascript"
$(function (){
$("p").click(function (){alert ("小P");})});/script/headbodyinput type="button" value ="PlayGame" id="btnClick" /
p第一個(gè)/p
p第二個(gè)/p/body說明:對所有P標(biāo)簽點(diǎn)擊都有彈出對話框的提示
第二種:CSS選擇器代碼如下:headtitle/title
script src ="Jq/jquery-1.4.2.js" type ="text/javascript" /script
script type ="text/javascript"
$(function (){
$(".warning").click(function (){alert("這是警告信息");});});/script
style type="text/css"
.warning{background-color :Yellow ;color :Red ;}/style/headbodyp沒有警告/p
div class ="warning " 請帶好小孩/div
p class ="warning "再次警告你/p
input class ="warning " type ="button" value ="別點(diǎn)啊" //body說明:對所有CSS樣式為:.warning點(diǎn)擊都有彈出對話框的提示
第三種:多條件選擇器代碼如下:headtitle/title
script src ="Jq/jquery-1.4.2.js"/script
script type ="text/javascript"
$(function (){
$(".docc,p,#txt1").click(function (){alert ("不要上當(dāng)啊");})})/script
style type="text/css"
.docc{background-color :Fuchsia ;color :Olive ;}/style/headbodyp電腦熱賣/p
input type ="text" id="txt1" /
var?aa,bb;
$.("#a").blur(function(){aa=true;});
$.("#b").blur(function(){bb=true;});
$.("#c").click(function(){
if(aabb){
aa=bb=false;
return?true;
}
else{
return?false;
}
});
你可以把后面的四個(gè)查詢條件放到一個(gè)form表單里,點(diǎn)擊查詢的時(shí)候,寫個(gè)ajax請求,將表單數(shù)據(jù)傳到后臺(tái)SQL,然后在success函數(shù)里面重新load一下datagrid應(yīng)該就可以了吧
你請求的頁面,可以帶多個(gè)參數(shù)進(jìn)去啊
$('#xs').load('ajax.php?age=3ban=2');
使用jquery的each()方法遍歷單元格,如果滿足條件則進(jìn)行相應(yīng)的操作
$(selector).each(function(index,element))
實(shí)例演示:在表格中按姓名查找記錄,找到則突出顯示,否則給出提示
創(chuàng)建Html元素
div?class="box"
span實(shí)例演示:在表格中按姓名查找記錄/spanbr
div?class="content"
姓名:nbsp;input?type="text"?name="name"nbsp;input?type="button"?value="查找"
table
trtd張三/tdtd175/tdtd140/td/tr
trtd李四/tdtd170/tdtd120/td/tr
trtd王五/tdtd185/tdtd160/td/tr
/table
/div
/div
設(shè)置css樣式
div.box{width:300px;padding:20px;margin:20px;border:4px?dashed?#ccc;}
div.boxspan{color:#999;font-style:italic;}
div.content{width:250px;margin:10px?0;padding:20px;border:2px?solid?#ff6666;}
input[type='text']{width:100px;padding:5px?10px;margin:5px?0;border:1px?solid?#ff9966;}
input[type='button']{height:30px;margin:10px;padding:5px?10px;}
table{border-collapse:collapse;}
td{width:80px;height:30px;line-height:30px;text-align:center;border:1px?solid?green;}
.selected{font-weight:bold?!important;?background:?#ff99cc?!important;color:#fff;}
編寫jquery代碼
$(function(){?
$(":button").click(function()?{
$("table?tr").removeClass('selected');???//?還原樣式
name?=?$("input[name='name']").val();????//?要查找的名字
flag?=?true;?????????????????????????????//?表示未查到目標(biāo)
$("table?tr").find("td:first").each(function()?{
if($(this).html()==name){????????????//?如果找到了
$(this).parent("tr").addClass('selected');????//?為整行設(shè)置樣式
flag?=?false;????????????????????//?將未找到標(biāo)記設(shè)為false
return?false;????????????????????//?提前終止循環(huán)
}
});
if(flag)?????????????????????????????????//?如果沒找到就給出提示
alert("查無此人");??
});
});
觀察效果
如果表中有相應(yīng)記錄
如果表中并無相應(yīng)記錄
$.post(url,{參數(shù):值,參數(shù):值。。。},function(data){處理返回值});
或類似于這樣:
$.ajax({ url: "test.html", success: function(){
$(this).addClass("done");
}});
具體有哪些參數(shù),參見:
網(wǎng)頁名稱:jquery條件查詢,jquery查找
URL地址:http://chinadenli.net/article26/dsshejg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、自適應(yīng)網(wǎng)站、網(wǎng)站排名、網(wǎng)站設(shè)計(jì)公司、電子商務(wù)、定制開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)