javascript 知识杂记

 遍历方法 

  for (var i = 0; i < ajaxdata.recordsFiltered //界限 譬如数组长度等等; i++)
            {

  }

 

数组中添加多个对象

目标:

var data = [
           {
               value: 22,
               color: getRandomColor(),//背景色
               label: "abc"//文字标签
           }, {
               value: 60,
               color: getRandomColor(),
               label: 'jquery'
           }, {
               value: 100,
               color: getRandomColor(),
               label: 'html'
           }
        ];

 

//首先 声明数组和对象
var
datas = []; 声明数组 function ObjStory(label, color, value) //声明对象 { this.label = label; this.color = color; this.value = value; } —————————————— 往数组插入对象 datas.push(new ObjStory("内科", getRandomColor(), “12”))

可以利用上面的遍历 来添加多个对象~

 

网页缓存完成后

 $(document).ready(function () {
        var str = @(bc.RandomName)_init();
        new QRCode(document.getElementById('@(bc.RandomName)_qrcode'), str);
        setTimeout("doPrint()", "100"); //延迟加载 等图片加载完再打印
    });

 

posted @ 2018-04-02 10:14  火腿肠的奋斗路  阅读(101)  评论(0编辑  收藏  举报