var eImg = document.createElement("img"); //创建一个img元素
eImg.src = "https://www.xxxx.com/static/images/logo.png"; //给img元素的src属性赋值
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.img {
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<div class="img"></div>
<script>
var i = document.getElementsByClassName("img");
i.innerText = "<img src='./imgaes/1.jpg'>"
console.log(i.innerText);
document.write(i.innerText)
</script>
</body>
</html>