20150302随笔

1.对象的查找

document.title = obj[self.today.substring(0, 7)];

不需要以下这么麻烦:

$.each(obj , function(index,val){
    var month = self.today.substring(0,7);
    if(index == month){
    document.title = val;
    }
});

 

2.each

如果是遍历节点时:

self.pages.each(function(index){

  $(this).css('z-index', self.pageLen+1);

})

如果遍历数组时:

$([1,2,11]).each(function(i,item){

  console.log(item)

})

 

posted @ 2015-03-02 16:10  vivi.wang  阅读(100)  评论(0编辑  收藏  举报