jquery 問答知識整理
: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"));
});
如果不加[]的話, $("table[id^=tb]:not(tbBasicInfo)"),這樣是不行的
這時not是基于前者id^=tb的tb進(jìn)行:not操作的
恢復(fù)BackGround-Color為原始的顏色
background-color:transparent
去掉Href的下劃線,已訪問過的樣式
a, a:visited{ text-decoration: none;}
去掉Li的點(diǎn)樣式
li{margin:0; padding:0; list-sytle:none}
獲取當(dāng)前對象的Style中的某種樣式
$("#divDept").css("display")
CSS BackGround Url 顯示不出來
因?yàn)镮E瀏覽器和FF對于處理路徑有一些差異,在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對象
$("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()取值有問題,改為val()
Google Chrome 中窗口最大化的問題
以下js代碼在FF,IE中沒問題
if (window.screen) {
var myw = screen.availWidth;
var myh = screen.availHeight;
window.resizeTo(400, 400);
window.moveTo(0, 0);
}
- 在Chrome中resizeTo,resize都是沒有效果的。
- By Design we don't support resize/move for tabs, only constrained windows.
- javascript resizeTo bug
- 在google chrome/safari 中textbox默認(rèn)是可以自由拉長的,為何控制不讓其自由拉長。

解決方案:
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):
會把正則表達(dá)式中類似*/去除
Sample:
value = s.replace(/^0*/, '');
After Compress:
value = s.replace(/^0, '');
- parseInt() 和 Number() 兩個函數(shù)有什么不同?
http://hi.baidu.com/iloverobot/blog/item/bd3ed651ffd362868c5430bf.html
- JSON 問題
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)更簡單的Ajax跨域請求
- 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:一個新的IMG標(biāo)簽屬性(附帶JQuery實(shí)現(xiàn))
http://css9.net/wp-content/uploads/2009/04/fullsize/example.html
有關(guān)于$.ajaxSetup和$.get的問題
在Common.js中使用
$.ajaxSetup({ url: "…..", type: "POST", cache: true, dataType: "json" }); $.ajax({ data: { cityCode: cityCode, flag: flag }, success: function(areaList) { …} });在PageA頁面引入Common.js
然后在腳本段中使用 $.get(url);
此處url調(diào)用的是一個aspx頁面,顯示結(jié)果為無數(shù)據(jù)加載!(正常情況:有數(shù)據(jù)加載。)
然后經(jīng)過使用IE8的開發(fā)人員工具,進(jìn)行Trace Error.最終發(fā)現(xiàn)原因錯誤信息(如下)
"Invalid JSON: <form name="form1" method="post" action="ajax_select
那么如何解決呢?
原因:
肯定是請求數(shù)據(jù)類型有問題?
解決方案:
1.在Page A 頁面腳本段 $.get(url,“html”);
因?yàn)?.get中的Data是可選項(xiàng),現(xiàn)在確定原因之后,我們就來預(yù)定義好DataType
結(jié)果:OK
分析源由:
是因?yàn)?.ajaxSetup是用全局設(shè)定的,所以全局已經(jīng)設(shè)定了DataType:JSON了。
那Page A 頁面的$.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)圖片裁剪思路及實(shí)現(xiàn)
JS,jquery不能實(shí)現(xiàn)圖片的裁剪,只是顯示了一個假象,在服務(wù)器上用獲得的各個坐標(biāo)值,以及原始圖片,用JAVA進(jìn)行裁剪2013-08-08
jquery.Jcrop結(jié)合JAVA后臺實(shí)現(xiàn)圖片裁剪上傳實(shí)例
這篇文章主要介紹了jquery.Jcrop結(jié)合JAVA后臺實(shí)現(xiàn)圖片裁剪上傳實(shí)例,具有一定的參考價值,感興趣的小伙伴們可以參考一下。2016-11-11
在Web項(xiàng)目中引入Jquery插件報錯的完美解決方案(圖解)
這篇文章主要介紹了在Web項(xiàng)目中引入Jquery插件報錯的完美解決方案的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-09-09
GridView中獲取被點(diǎn)擊行中的DropDownList和TextBox中的值
本文為大家介紹下如何通過點(diǎn)擊GridView中的a標(biāo)簽獲取被點(diǎn)擊行中的下拉框和文本框中的值,具體實(shí)現(xiàn)嗲嗎如下,感興趣的朋友可以參考下哈,希望對大家有所幫助2013-07-07
jQuery+ajax實(shí)現(xiàn)局部刷新的兩種方法
在項(xiàng)目中,經(jīng)常會用到ajax,比如實(shí)現(xiàn)局部刷新,比如需要前后端交互等,這里呢分享局部刷新的兩種方法,主要用的是ajax里面的.load()。感興趣的朋友一起看看吧2017-06-06
jQuery計算textarea中文字?jǐn)?shù)(剩余個數(shù))的小程序
這篇文章主要介紹了jQuery計算textarea中文字?jǐn)?shù)(剩余個數(shù))的示例程序,大家參考使用吧2013-11-11





