嗨,我不知道如何使用 js 将 src 添加到图像
//e6
//this code create a new 'img' element
let newElementImg = document.createElement("img");
//this code add img from url
newElementImg.src = "url('https://cdn.wallpapersafari.com/50/24/PZpRVx.jpg')";
//this code set a list of classes for the 'img' element
newElementImg.classList.add("img-fluid");
//append newElementLink to an existing element which has an 'footer-about' ID
var imgDiv = document.getElementById('footer-about');
imgDiv.append(newElementImg);
它有点工作,但图像不只显示“图像损坏”图标 [像这样] 1
森林海
慕标5832272
相关分类