ul,li{margin:0px;padding:0px;list-style:none;}
.Loading{width:400px;/*margin-left:auto;//margin-right:auto;*/margin:0 auto;visibility:hidden;}
#contentsecond{width:300px;height:100px;}
$("#realcontent").load("test.html");
$("div.contentin").removeClass("contentin");
function setBorder( n ){ }
(function() { var // Will speed up references to window, and allows munging its name. window = this, // Will speed up references to undefined, and allows munging its name. undefined, // Map over jQuery in case of overwrite _jQuery = .jQuery, // Map over the $ in case of overwrite _$ = window.$, jQuery = window.jQuery = window.$ = function(selector, context) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init(selector, context); }, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.,]*$/; jQuery.fn = jQuery.prototype = { init: function(selector, context) { // Make sure that a selection was provided // Make sure that a selection was provided selector = selector || document; this[0] = selector; this.length = 1; this.context = selector; return this; }, show:function() { alert("this.show"); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.3.2" }; jQuery.fn.init.prototype = jQuery.fn; })(); function test(src){ alert($(src)); $(src).show();
像這樣的就是隱式迭代因為$(".yourclass")選到的元素不一定只有一個,比如$(".yourclass")選中n個元素 這n個元素都會加上"newclas"這個class,除了ID選取器其它都是隱式迭代的比如$("#yourclass") 就算有多個id="yourclass" 也只能得到第1個在jqery中,因為它迭代的時候只取第一個元素!所有的方法都被設計成自動操作對象集合,而不是單一的一個對象,這樣避免了大量的沒有意義的迴圈
1,要向寫好代碼,必須不斷最佳化改進!
2,要向做好軟體,盡量靈活抽象是正道
3,一個團隊的管理,猶如設計一個頁面,快速定位某項工作的基礎是有一個全域的管理觀念(參考代碼中的window)