var imgObj=document.createElement("div"); imgObj.style.backgroundImage="url(imgs/images/7.png)"
console.log(imgObj)
imgObj.setAttribute("style","position:absolute;left:"+left+"px;top:"+top+"px; background-repeat:
no-repeat;background-position: center; background-size: cover; height:35px; width:35px;border-radius: 100%;");
$(".scan-gold-pic").append(imgObj);
没有报错;能够创造出节点;但是图片无法宣示;请问问题在哪里我在调试的时候发现没有添加图片
1 回答

www说
TA贡献1775条经验 获得超8个赞
imgObj.setAttribute("background-image","url(imgs/images/7.png)")这么写有问题啊
imgObj.style.backgroundImage="url(imgs/images/7.png)"
添加回答
举报
0/150
提交
取消