我有一个数组:
[{
"img_ID": 1,
"ci_ID": 1,
"ciCode": "CI_00001ID",
"Title": "my_images_01",
"Image": "C:\\Users\\SMG48\\Downloads\\Images\\wp2448691-jihyo-twice-wallpapers.jpg"
}]
有没有办法显示 Image
在 <img>
中的数组上使用 JavaScript 标记?
最佳答案
在获取数组的函数内部:
function displayImg(array) {
var img;
for (var i = 0; i < array.length; i++) {
img = document.createElement('img');
img.source(array[i]['Image']);
document.appendChild(img); // if you want just to append to parent
}
}
关于javascript - 如何使用 javascript 在 <img> 元素中显示图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57569855/