道非道 非常道

          勤思、謹言、慎行、厚積、薄發(fā)

          導(dǎo)航

          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          公告

          在非洲,
          瞪羚每天早上醒來時,
          他知道自己必須跑的比最快的獅子還快,
          否則就會被吃掉。
          獅子每天早上醒來時,
          他知道自己必須追上跑的最慢的瞪羚,
          否則就會被餓死。
          不管你是獅子還是瞪羚,
          當(dāng)太陽升起時,你最好開始奔跑。

          ----摘自<世界是平的>-托馬斯.弗里德曼



          隨筆分類(92)

          文章分類(58)

          收藏夾(11)

          隨筆檔案(106)

          文章檔案(66)

          統(tǒng)計

          web

          天圓

          經(jīng)濟 政治 軍事

          鍵康

          [轉(zhuǎn)] jQuery.extend函數(shù)詳細用法

          轉(zhuǎn)自網(wǎng)絡(luò)

          jQuery.extend擴展函數(shù)的用法記錄下來。

          1、擴展jQuery靜態(tài)方法.

          1$.extend({
          2test:function(){alert('test函數(shù)')}
          3}
          )

          用法: $.test()

          2、合并多個對象.
          為jQuery.extend(css1,css2)為例,css1,css2個有一些屬性(法照樣會比處理,這里之講屬性).
          extend函數(shù)會把css2有而css2沒有的屬性加到css1中,如果css2的某個屬性與css1的某個屬性名稱享用,就會用css2的屬性去覆蓋css1的同名屬性。css1就是最后的整和對象?;蛘咭部梢杂?:
          var newcss = jquery.extend(css1,css2)  newcss就是合并的新對象。
          var newcss = jquery.extend({},css1,css2) newcss就是合并的新對象.而且沒有破壞css1的結(jié)構(gòu)。

          1//用法: jQuery.extend(obj1,obj2,obj3,..)
          2var Css1={size: "10px",style: "oblique"}
          3var Css2={size: "12px",style: "oblique",weight: "bolder"}
          4$.jQuery.extend(Css1,Css2)
          5//結(jié)果:Css1的size屬性被覆蓋,而且繼承了Css2的weight屬性
          6// Css1 = {size: "12px",style: "oblique",weight: "bolder"}
          7


          3。深度鑲套對象
          新的extend()允許你更深度的合并鑲套對象。下面的例子是一個很好的證明。
           1// 以前的 .extend()   
           2   jQuery.extend(   
           3     { name: “John”, location: { city: “Boston” } },   
           4     { last: “Resig”, location: { state: “MA” } }   
           5   );   
           6    // 結(jié)果:   
           7    // => { name: “John”, last: “Resig”, location: { state: “MA” } }
           8  // 新的更深入的 .extend()   
           9   jQuery.extend( true,   
          10   { name: “John”, location: { city: “Boston” } },   
          11     { last: “Resig”, location: { state: “MA” } }   
          12  );   
          13  // 結(jié)果   
          14   // => { name: “John”, last: “Resig”,   
          15  //      location: { city: “Boston”, state: “MA” } }  
          16
          17
             

          posted on 2010-01-21 16:56 星期五 閱讀(554) 評論(0)  編輯  收藏 所屬分類: jquery


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 澄城县| 景宁| 陇川县| 天津市| 丁青县| 宁德市| 南部县| 子洲县| 攀枝花市| 盐池县| 察雅县| 乌兰县| 沿河| 云龙县| 仁怀市| 红安县| 定陶县| 正阳县| 佛冈县| 奉化市| 邮箱| 绥江县| 齐齐哈尔市| 介休市| 米脂县| 龙口市| 镇赉县| 桃江县| 石河子市| 桂平市| 博湖县| 巢湖市| 商水县| 临沧市| 大同市| 孝义市| 临城县| 凉城县| 西贡区| 隆德县| 都江堰市|