基本上,这个网页有两种语言的内容,这就是为什么我想从JavaScript对象传递带有段落的图像。但是它显示的是[对象HTMLImageElement]而不是图像。
HTML格式:
<p id="ourvisioncardparagraph" >
// Here the image will appear with paragraph tag
</p>
js:
var img = new Image();
img.src ="https://images.unsplash.com/photo-1664575198308-3959904fa430?ixlib=rb-4.0.3&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80";
img.alt = "star"
var data = {
english: {
ourvisioncardparagraph: `To reinvent finance through innovation & technology ${img} making
it convenient, accessible & fair to all.`
}
}
1条答案
按热度按时间ou6hu8tu1#
你可以使用
img.outerHTML
来得到一个元素html.所以总而言之: