使用javascript显示多个图像

使用javascript显示多个图像,javascript,html,instagram,javascript-objects,instagram-api,Javascript,Html,Instagram,Javascript Objects,Instagram Api,我尝试用javascript显示图像,它可以工作,但在使用instagram图像抽象实现时,多个图像不能被视为背景,它似乎没有使用标记a的数据背景图像,显然有以下代码行: 美元。gethttps://images+~~Math.random*33+-focus opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/ +名称+/,函数HTML{ 如果没有添加背景图像,我

我尝试用javascript显示图像,它可以工作,但在使用instagram图像抽象实现时,多个图像不能被视为背景,它似乎没有使用标记a的数据背景图像,显然有以下代码行:

美元。gethttps://images+~~Math.random*33+-focus opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/ +名称+/,函数HTML{

如果没有添加背景图像,我会丢失什么

这是我的观点:`

var名称=图例阿诺德·施瓦辛格; $.gethttps://images+~~Math.random*33+-focus opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/ +名称+/,函数HTML{ 如果html{ var regex=/_sharedData={.*;/m, json=json.parseregex.exechtml[1], edges=json.entry\u data.ProfilePage[0].graphql.user.edge\u owner\u to\u timeline\u media.edges; $.eachdges,function n,edge{ var节点=edge.node; var div=document.createElementdiv; div.className=col-xl-6; div.innerHTML= \n′; getElementById'insta_images'。appendChilddiv; }; } }; 这个

不向元素添加背景图像样式-数据背景图像只是元素上的一些数据

div.innerHTML =
    "<a href='"+node.thumbnail_src + "' class='photo-box mfp-gallery' data-toggle='lightbox' title='Instagram' style='width: 400px;background-image:url("+node.thumbnail_src+")'>\n" +
    '<div class="photo-box-content">\n' +
    "<span>Instagram</span>\n" +
    '</div>\n' +
    '</a>\n';

应该这样做吧

嗨,Jeff。我已经将您的代码转换成了一个片段,这样您就可以看到json.entry\U data.ProfilePage是未定义的错误。听起来好像没有返回任何用户数组。您需要测试该数组是否未定义。@MIKEPOLE-代码有时根据生成的随机数工作:ptthe attri但是数据背景图像不显示背景图像-它只是一个数据属性
div.innerHTML =
    "<a href='"+node.thumbnail_src + "' class='photo-box mfp-gallery' data-toggle='lightbox' title='Instagram' style='width: 400px;background-image:url("+node.thumbnail_src+")'>\n" +
    '<div class="photo-box-content">\n' +
    "<span>Instagram</span>\n" +
    '</div>\n' +
    '</a>\n';