图片循环显示添加html界面上

1.图片循环显示添加html界面上 代码示例:

<div id="content">
    <div class="note">
    </div>
</div>
        var html="";
       // var data=JSON.parse(packet);
        var data=[
        {Tname:"美丽的图片呀",Tphotoslt:"/photo/444323232.png"},
        {Tname:"精彩的图片呀",Tphotoslt:"/photo/123.png"}
        ];
        for(var i=0,len=data.length;i<len;i++)
        {
            html+="<div class='pubu'>";
            html+="<img src='picture/"+data[i]['Tphotoslt']+"' />";
            html+="<div class='pubu_pubu'>";
            html+="<h4>";
            html+=data[i]['Tname'];
            html+="</h4>";
            html+="</div></div>";
        }
        $('.note').innerHTML=html;

 2. 如有问题 可以评论  我会为你解答;

猜你喜欢

转载自blog.csdn.net/qq_38366657/article/details/81270424