我试图在点击时制作一行图像,但它们显示在我页面底部的 div 标签之后,是 document.body.innerHTML 让它这样做吗?
flowers = 1;
function makeFlower() {
if (flowers < 10 ){document.body.innerHTML +="<img src='flower.jpg'>";
flowers ++;
}
}
<p> Make a happy garden by clicking the flower many times! </p>
<p><img src="flower.jpg"
onClick="makeFlower()">
</p>