jquery 問(wèn)答知識(shí)整理
:not用法
1. 列表用法
var notList = [];
notList.push("#<%=txtSuggest.ClientID %>");
var textElements = $("input[type=text]:not(" + notList + ")");
var firstFocusItem = null;
//遍歷Type=Text的元素
textElements.each(function(i) {
//TODO
});
2.排它用法
$("table[id^=tb]:not([id=tbBasicInfo])").each(function() {
alert($(this).attr("id"));
});
如果不加[]的話(huà), $("table[id^=tb]:not(tbBasicInfo)"),這樣是不行的
這時(shí)not是基于前者id^=tb的tb進(jìn)行:not操作的
恢復(fù)BackGround-Color為原始的顏色
background-color:transparent
去掉Href的下劃線(xiàn),已訪(fǎng)問(wèn)過(guò)的樣式
a, a:visited{ text-decoration: none;}
去掉Li的點(diǎn)樣式
li{margin:0; padding:0; list-sytle:none}
獲取當(dāng)前對(duì)象的Style中的某種樣式
$("#divDept").css("display")
CSS BackGround Url 顯示不出來(lái)
因?yàn)镮E瀏覽器和FF對(duì)于處理路徑有一些差異,在IE下修改boxy.css代碼如下。
.boxy-wrapper .top-left { background: url('images/boxy-nw.png'); }
.boxy-wrapper .top-right { background: url('images/boxy-ne.png'); }
.boxy-wrapper .bottom-right { background: url('images/boxy-se.png'); }
.boxy-wrapper .bottom-left { background: url('images/boxy-sw.png'); }
/* IE6+7 hacks for the border. IE7 should support this natively but fails in conjuction with modal blackout bg. */
/* NB: these must be absolute paths or URLs to your images */
.boxy-wrapper .top-left { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/boxy-nw.png'); }
.boxy-wrapper .top-right { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/boxy-ne.png'); }
.boxy-wrapper .bottom-right { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/boxy-se.png'); }
.boxy-wrapper .bottom-left { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/boxy-sw.png'); }
這樣就能在IE下顯示正常了。
獲取Table對(duì)象
$("table[id=tableID]") 或者 $("#tableID")CountDown用法
$.getJSON(
loginServiceUrl,{ method: "Logout"},
function(result) {
if (result.Url != null) {
$("#transfer").countdown({
until: "+5s",
expiryUrl: result.Url,
onTick: function(periods){
$(this).text(periods[6]);
}
});
}
});
Google Chrome中text()取值有問(wèn)題,改為val()
Google Chrome 中窗口最大化的問(wèn)題
以下js代碼在FF,IE中沒(méi)問(wèn)題
if (window.screen) {
var myw = screen.availWidth;
var myh = screen.availHeight;
window.resizeTo(400, 400);
window.moveTo(0, 0);
}
- 在Chrome中resizeTo,resize都是沒(méi)有效果的。
- By Design we don't support resize/move for tabs, only constrained windows.
- javascript resizeTo bug
- 在google chrome/safari 中textbox默認(rèn)是可以自由拉長(zhǎng)的,為何控制不讓其自由拉長(zhǎng)。

解決方案:
CSS to disable resizing textarea { resize: none; } <textarea name="foo"> textarea[name=foo] { resize: none; } HTML is <textarea id="foo">) #foo { resize: none; }
- JS壓縮工具
http://www.brainjar.com/js/crunch/demo.html
缺點(diǎn):
會(huì)把正則表達(dá)式中類(lèi)似*/去除
Sample:
value = s.replace(/^0*/, '');
After Compress:
value = s.replace(/^0, '');
- parseInt() 和 Number() 兩個(gè)函數(shù)有什么不同?
http://hi.baidu.com/iloverobot/blog/item/bd3ed651ffd362868c5430bf.html
- JSON 問(wèn)題
http://blog.csdn.net/chinaontology/archive/2007/12/30/2004871.aspx
- CSS置底的提示框
- 大文件上傳 進(jìn)度條顯示 (仿csdn資源上傳效果)
http://www.cnblogs.com/zengxiangzhan/archive/2010/01/14/1647866.html
- 可編輯的Input
- jquery設(shè)置html頭信息
http://home.phpchina.com/space.php?uid=155537&do=blog&id=182698
- jQuery與prototype(ajaxpro)沖突的解決方法
http://www.cnblogs.com/sxlfybb/archive/2009/06/04/1495995.html
- 利用jQuery + Handler(ashx) + LINQ 實(shí)現(xiàn) Autocomplete
http://www.dotblogs.com.tw/puma/archive/2009/03/10/7426.aspx
- jquery ajax 中文亂碼
- Ajax中文亂碼原因分析及解決方案
http://hi.baidu.com/sihillver/blog/item/4d6f32f592920325bc3109d7.html
- 打造基于jQuery的高性能TreeView
- 利用jQuery實(shí)現(xiàn)更簡(jiǎn)單的Ajax跨域請(qǐng)求
- Jquery.Ajax 讀取XML
first of all sorry about my english, it's not my native lengauge... i have a xml file that i'm reading with the sample code above...but when i try to read it from a service web page (http://www.google.com/ig/api?weather=Buenos%20A...),it doesn't show anything... and if i write the same content of this page in a xml file in my pc,
it works perfectly... i dont know what am i doing wrong i let u the code that i'm using maybe u could help me function clima(){ $.ajax({ type: "GET", url: 'http://www.google.com/ig/api?weather=Buenos%20Aires', dataType: "xml", success: function(data){ var $weather = $(data).find('current_conditions') console.log($weather); } }); } function clima() { $.ajax({ type: "GET", dataType: "xml", url: 'http://www.google.com/ig/api?weather=Buenos%20Aires', success: function(xml) { var weather = $(xml).find("current_conditions").find("temp_c").attr("data"); alert("Prognostico para hoy: " + weather + " grados"); } }); }
- FullSize:一個(gè)新的IMG標(biāo)簽屬性(附帶JQuery實(shí)現(xiàn))
http://css9.net/wp-content/uploads/2009/04/fullsize/example.html
有關(guān)于$.ajaxSetup和$.get的問(wèn)題
在Common.js中使用
$.ajaxSetup({ url: "…..", type: "POST", cache: true, dataType: "json" }); $.ajax({ data: { cityCode: cityCode, flag: flag }, success: function(areaList) { …} });在PageA頁(yè)面引入Common.js
然后在腳本段中使用 $.get(url);
此處url調(diào)用的是一個(gè)aspx頁(yè)面,顯示結(jié)果為無(wú)數(shù)據(jù)加載?。ㄕG闆r:有數(shù)據(jù)加載。)
然后經(jīng)過(guò)使用IE8的開(kāi)發(fā)人員工具,進(jìn)行Trace Error.最終發(fā)現(xiàn)原因錯(cuò)誤信息(如下)
"Invalid JSON: <form name="form1" method="post" action="ajax_select
那么如何解決呢?
原因:
肯定是請(qǐng)求數(shù)據(jù)類(lèi)型有問(wèn)題?
解決方案:
1.在Page A 頁(yè)面腳本段 $.get(url,“html”);
因?yàn)?.get中的Data是可選項(xiàng),現(xiàn)在確定原因之后,我們就來(lái)預(yù)定義好DataType
結(jié)果:OK
分析源由:
是因?yàn)?.ajaxSetup是用全局設(shè)定的,所以全局已經(jīng)設(shè)定了DataType:JSON了。
那Page A 頁(yè)面的$.get()肯定受及影響。
最終解決方案:
改Common.js,去掉ajaxSetup全局設(shè)定
$.ajax({ url: "…..", type: "POST", cache: true, dataType: "json",data: { cityCode: cityCode, flag: flag }, success: function(areaList) { …} });
結(jié)果:OK
相關(guān)文章
jQuery實(shí)現(xiàn)圖片向左向右切換效果的簡(jiǎn)單實(shí)例
下面小編就為大家?guī)?lái)一篇jQuery實(shí)現(xiàn)圖片向左向右切換效果的簡(jiǎn)單實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05jQuery遍歷頁(yè)面所有CheckBox查看是否被選中的方法
這篇文章主要介紹了jQuery遍歷頁(yè)面所有CheckBox查看是否被選中的方法,涉及jQuery鏈?zhǔn)讲僮骷搬槍?duì)CheckBox的操作技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-04-04jquery 插件實(shí)現(xiàn)圖片延遲加載效果代碼
前幾天上QQ的在線(xiàn)視頻網(wǎng)站,看到上面的影片列表頁(yè)的圖片有這樣一種效果:當(dāng)向下拉動(dòng)滾動(dòng)條時(shí)下面的圖片才開(kāi)始加載,就是說(shuō)它不會(huì)一下子把所有的圖片都加載出來(lái),拉動(dòng)滾動(dòng)條后用戶(hù)看到了才會(huì)顯示,這是一個(gè)很不錯(cuò)的用戶(hù)體驗(yàn)。2010-02-02BootStrap中按鈕點(diǎn)擊后被禁用按鈕的最佳實(shí)現(xiàn)方法
在項(xiàng)目開(kāi)發(fā)中經(jīng)常會(huì)遇到這樣的功能,為了防止在Bootstrap中點(diǎn)擊按鈕多次提交,所以希望點(diǎn)擊按鈕后禁用按鈕。怎么實(shí)現(xiàn)此功能呢?今天腳本之家小編給大家分享BootStrap中按鈕點(diǎn)擊后被禁用按鈕的最佳實(shí)現(xiàn)方法,非常不錯(cuò),感興趣的朋友參考下吧2016-09-09jQuery居中元素scrollleft計(jì)算方法示例
這篇文章主要介紹了jQuery居中元素scrollleft計(jì)算方法,結(jié)合實(shí)例形式分析了jQuery獲取及計(jì)算頁(yè)面滾動(dòng)元素的相關(guān)操作技巧,需要的朋友可以參考下2017-01-01使用jQuery輕松實(shí)現(xiàn)Ajax的實(shí)例代碼
在Asp.Net的MVC架構(gòu)中使用jQuery是一件很容易的事情,而使用jQuery實(shí)現(xiàn)Ajax更加簡(jiǎn)單。2010-08-08