1.求陣列元素所佔百分比:
12.$.map與$.each比較:function
percentage(number1, number2)
13.convert後端資料轉換:var arr1 = ;2//
arr2 = ['yu','jian']
3var arr2 = $.map(arr1, function (v,k) );
4var arr1 = [0, 3, 5];5//
arr2 = [0,3,5]
6var arr2 = $.map(arr1, function (v,k) );
14.獲取物件的最後乙個元素,並替換相應的key值:var mapdataparser = new
(stats.resultparser.extend(,arr=,self = this,sum = this.getsum(data,'pvcnt');5//
index 用於判斷是國內還是國家;
6var index = data[0].hasownproperty('common_loc_prov') ? 'common_loc_prov' : 'common_loc_nat';
7 $.each(data,function
(k, v) ;
13});
14return
this
.gettop(arr,num);15}
16},
1718 gettop:function
(data,num)
26})
27arrs.push()
32return
arrs;
33},
34 getsum:function
(arr,index) )
39return
sum;
40},
41 }))();
1 data = thisview code._convertd(data);
2 _convertd: function
(data) ;
6var pvobj = this._get1keyval(data,'瀏覽量pv','pvcnt');
7var ipobj = this._get1keyval(data,'獨立ip','ipcnt');
8 objs['瀏覽量pv'+'_'+pvobj['瀏覽量pv']] =pvobj.value;
9 objs['獨立ip'+'_'+ipobj['獨立ip']] =ipobj.value;10}
11return
objs;
12},
13 _getmax:function
(data) ;
15for(var k in
data);19}
20return arrs[1];
21},
22 _get1keyval:function
(data,index,value) , objs ={};
24for (var k in
data)
31result.push(obj);
32 obj ={};33}
34 objs[index] =k;
35 objs['value'] =result;
36return
objs;37}
38 }
5.當乙個元件需要呼叫後端多個介面獲取資料並拼接時,可以讓後台只返回乙個介面,並將資料組合:
6.資料處理最佳實踐:
7.js頁面跳轉事件:window.onbeforeunload:
1view codevar isuploadfinish = true;2
var uploadcount = 0;
3var isuploadstart = false
;4 window.onbeforeunload = function
(e)
10if (!isuploadstart && uploadcount != 0)
15 };
8.將具有length屬性的類陣列物件轉化為陣列:
var args = array.prototype.slice.call(arguments, 1);
工作中小知識點彙總(c )
1 oop 實體與資料庫字段轉換 注意 此時實體字段必須和資料庫中查詢的字段列名相同 list modelextend.getbydatatablepart ds.tables 0 實體和datatable都有的資料才回給實體賦值 public static listgetbydatatablepa...
工作中小知識點彙總(sql)
1 with nolock 在查詢表的時候加上它可以增加33 查詢效率 例子 select top 5 b.username,f.issueddate,r.tktedtime,r.refundsign,r.initdate,f.status from forderform f with nolock...
工作中知識點散記二三
1 text indent 首航縮排,text align justify 兩端對齊 1 首航縮排 font size 14px text indent 28px 如果要縮排兩個字的寬度,就設成現在字型大小的二倍 2 兩端對齊 text align justify text align last j...