Blogger Information
Blog 32
fans 0
comment 0
visits 24108
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
js记录1
Nevermore的博客
Original
843 people have browsed it

1.获得数组中元素出现的次数

 var obj = {};
  for(var i= 0, l = stmeterinfo.length; i< l; i++){
      var item = stmeterinfo[i]['typename'];
      obj[item] = (obj[item] +1 ) || 1;    
  }
for(index in obj)    //index 遍历对象
{
   console.log(obj[index]);
}

2.addEventListener() 添加多个事件,不会重复,顺序执行,stoppropagation()阻止事件传播,


3. js 的词法分析,第一步,分析参数, 第二步看内部var ,第三步看内部function  ,分析后执行


4.js中 组装的html 任何参数传入都会被当成字符串,解决方法就是转成jq对象

  function (value, row, index) {

                    var e = '';

                    e = '<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">审批</button>';

                    e = $(e);//此处将html转换成jquery对象

                    e.click(function(){

                        processBR(row);

                    })

                    return e;

                }


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post